[GRASS-SVN] r67578 - grass/trunk/tools
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jan 13 05:01:32 PST 2016
Author: lucadelu
Date: 2016-01-13 05:01:32 -0800 (Wed, 13 Jan 2016)
New Revision: 67578
Modified:
grass/trunk/tools/mkhtml.py
Log:
documentation: fixed link to source list for each module
Modified: grass/trunk/tools/mkhtml.py
===================================================================
--- grass/trunk/tools/mkhtml.py 2016-01-13 12:24:07 UTC (rev 67577)
+++ grass/trunk/tools/mkhtml.py 2016-01-13 13:01:32 UTC (rev 67578)
@@ -22,13 +22,14 @@
import re
from datetime import datetime
from HTMLParser import HTMLParser
+import urlparse
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"
+source_url = "https://trac.osgeo.org/grass/browser/grass/trunk/"
header_base = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
@@ -60,7 +61,7 @@
<p>
<a href="index.html">Main index</a> |
<a href="${INDEXNAME}.html">${INDEXNAMECAP} index</a> |
-<a href="${URL}/${FOLDER}/${PGM}">Source code</a> |
+<a href="${URL}">Source code</a> |
<a href="topics.html">Topics index</a> |
<a href="keywords.html">Keywords index</a> |
<a href="graphical_index.html">Graphical index</a> |
@@ -97,7 +98,6 @@
</html>
""")
-
def read_file(name):
try:
f = open(name, 'rb')
@@ -263,6 +263,7 @@
'v' : 'vector'
}
+
def to_title(name):
"""Convert name of command class/family to form suitable for title"""
return name.capitalize()
@@ -293,17 +294,15 @@
year = str(datetime.now().year)
# check the names of scripts to assign the right folder
-topdir = os.getenv("MODULE_TOPDIR")
-scripts = os.listdir(os.path.join(topdir, 'scripts'))
-if pgm in scripts:
- folder = 'scripts'
-else:
- folder = index_name
+topdir = os.path.abspath(os.getenv("MODULE_TOPDIR"))
+curdir = os.path.abspath(os.path.curdir)
+pgmdir = curdir.replace(topdir, '').lstrip('/')
+url = urlparse.urljoin(source_url, pgmdir)
+
if index_name:
- sys.stdout.write(footer_index.substitute(INDEXNAME=index_name, PGM=pgm,
+ sys.stdout.write(footer_index.substitute(INDEXNAME=index_name,
INDEXNAMECAP=index_name_cap,
- YEAR=year, URL=source_url,
- FOLDER=folder,
+ YEAR=year, URL=url,
GRASS_VERSION=grass_version))
else:
sys.stdout.write(footer_noindex.substitute(YEAR=year,
More information about the grass-commit
mailing list