[GRASS-SVN] r70605 - grass/branches/releasebranch_7_2/tools

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Feb 16 23:14:04 PST 2017


Author: martinl
Date: 2017-02-16 23:14:04 -0800 (Thu, 16 Feb 2017)
New Revision: 70605

Modified:
   grass/branches/releasebranch_7_2/tools/mkhtml.py
Log:
broken links to source code and history in add-ons user manuals (see #3224)
       (merge r70546 from trunk)


Modified: grass/branches/releasebranch_7_2/tools/mkhtml.py
===================================================================
--- grass/branches/releasebranch_7_2/tools/mkhtml.py	2017-02-17 02:50:49 UTC (rev 70604)
+++ grass/branches/releasebranch_7_2/tools/mkhtml.py	2017-02-17 07:14:04 UTC (rev 70605)
@@ -307,10 +307,18 @@
 pgmdir = curdir.replace(topdir, '').lstrip('/')
 if os.getenv('SOURCE_URL', ''):
     # addons
-    pgmname = os.path.basename(pgmdir)
-    classname = index_names[pgmname[:pgmname.find('.')]]
-    url_source = urlparse.urljoin('{0}{1}/'.format(os.environ['SOURCE_URL'], classname),
-                                  pgmname)
+    url_source = ''
+    for prefix in index_names.keys():
+        cwd = os.getcwd()
+        idx = cwd.find('{0}{1}.'.format(os.path.sep, prefix))
+        if idx > -1:
+            pgmname = cwd[idx+1:]
+            classname = index_names[prefix]
+            url_source = urlparse.urljoin('{0}{1}/'.format(
+                    os.environ['SOURCE_URL'], classname),
+                    pgmname
+            )
+            break
 else:
     url_source = urlparse.urljoin(source_url, pgmdir)
 if index_name:



More information about the grass-commit mailing list