Sfoglia il codice sorgente

mkhtml.py: Fix broken links for addon manuals when compiling without SOURCE_URL (Fix https://trac.osgeo.org/grass/ticket/3224)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@70737 15284696-431f-4ddb-bdfa-cd5b030d7da7
Huidae Cho 8 anni fa
parent
commit
2a11ea602d
1 ha cambiato i file con 9 aggiunte e 2 eliminazioni
  1. 9 2
      tools/mkhtml.py

+ 9 - 2
tools/mkhtml.py

@@ -39,7 +39,8 @@ pgm = sys.argv[1]
 src_file = "%s.html" % pgm
 tmp_file = "%s.tmp.html" % pgm
 
-source_url = "https://trac.osgeo.org/grass/browser/grass/trunk/"
+trunk_url = "https://trac.osgeo.org/grass/browser/grass/trunk/"
+addons_url = "https://trac.osgeo.org/grass/browser/grass-addons/"
 
 header_base = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
@@ -314,7 +315,13 @@ if not year:
 # check the names of scripts to assign the right folder
 topdir = os.path.abspath(os.getenv("MODULE_TOPDIR"))
 curdir = os.path.abspath(os.path.curdir)
-pgmdir = curdir.replace(topdir, '').lstrip(os.path.sep)
+if curdir.startswith(topdir):
+    source_url = trunk_url
+    pgmdir = curdir.replace(topdir, '').lstrip(os.path.sep)
+else:
+    # addons
+    source_url = addons_url
+    pgmdir = os.path.sep.join(curdir.split(os.path.sep)[-3:])
 url_source = ''
 if os.getenv('SOURCE_URL', ''):
     # addons