[GRASS-SVN] r59831 - grass/trunk/man
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Apr 20 04:31:30 PDT 2014
Author: martinl
Date: 2014-04-20 04:31:30 -0700 (Sun, 20 Apr 2014)
New Revision: 59831
Modified:
grass/trunk/man/build_full_index.py
grass/trunk/man/build_html.py
Log:
generate TOC also for full_index
Modified: grass/trunk/man/build_full_index.py
===================================================================
--- grass/trunk/man/build_full_index.py 2014-04-20 10:47:59 UTC (rev 59830)
+++ grass/trunk/man/build_full_index.py 2014-04-20 11:31:30 UTC (rev 59831)
@@ -15,33 +15,40 @@
os.chdir(html_dir)
+class_labels = {
+ 'd' : 'display',
+ 'db' : 'database',
+ 'g' : 'general',
+ 'i' : 'imagery',
+ 'm' : 'miscellaneous',
+ 'ps' : 'postscript',
+ 'r' : 'raster',
+ 'r3' : '3d raster',
+ 't' : 'temporal',
+ 'v' : 'vector'
+}
+
classes = []
for cmd in html_files('*'):
prefix = cmd.split('.')[0]
- if prefix not in classes:
- classes.append(prefix)
-classes.sort()
+ if prefix not in [item[0] for item in classes]:
+ classes.append((prefix, class_labels.get(prefix, prefix)))
+classes.sort(key=lambda tup: tup[0])
#begin full index:
filename = "full_index.html"
f = open(filename + ".tmp", 'wb')
-write_html_header(f, "GRASS GIS %s Reference Manual: Full index" % grass_version)
+write_html_header(f, "GRASS GIS %s Reference Manual: Full index" % grass_version, body_width="80%")
#generate main index of all modules:
f.write(full_index_header)
-#"
-for cls in classes:
- f.write(cmd1_tmpl.substitute(cmd = cls))
- if cls != classes[-1]:
- f.write(" | ")
+f.write(toc)
-f.write(sections)
-
#for all module groups:
-for cls in classes:
- f.write(cmd2_tmpl.substitute(cmd = cls))
+for cls, cls_label in classes:
+ f.write(cmd2_tmpl.substitute(cmd_label = cls_label.title(), cmd = cls))
#for all modules:
for cmd in html_files(cls):
basename = os.path.splitext(cmd)[0]
Modified: grass/trunk/man/build_html.py
===================================================================
--- grass/trunk/man/build_html.py 2014-04-20 10:47:59 UTC (rev 59830)
+++ grass/trunk/man/build_html.py 2014-04-20 11:31:30 UTC (rev 59831)
@@ -48,7 +48,7 @@
header2_tmpl = string.Template(\
r""" <link rel="stylesheet" href="grassdocs.css" type="text/css">
</head>
-<body style="width: 99%">
+<body style="width: ${body_width}">
<!-- this file is generated by man/build_html.py -->
@@ -174,13 +174,9 @@
""")
#"
-cmd1_tmpl = string.Template(\
-r"""<b><a href="#${cmd}">${cmd}.*</a></b>""")
-#"
-
cmd2_tmpl = string.Template(\
r"""<a name="${cmd}"></a>
-<h3>${cmd}.* commands:</h3>
+<h3>${cmd_label} commands (${cmd}.*)</h3>
<table>
""")
#"
@@ -190,23 +186,24 @@
""")
#"
-sections = \
-r""" ]
-<table border=0>
-<tr><td> <a href="full_index.html#d">d.*</a> </td><td>display commands</td></tr>
-<tr><td> <a href="full_index.html#db">db.*</a> </td><td>database commands</td></tr>
-<tr><td> <a href="full_index.html#g">g.*</a> </td><td>general commands</td></tr>
-<tr><td> <a href="full_index.html#i">i.*</a> </td><td>imagery commands</td></tr>
-
-<tr><td> <a href="full_index.html#m">m.*</a> </td><td>miscellaneous commands</td></tr>
-<tr><td> <a href="full_index.html#ps">ps.*</a> </td><td>postscript commands</td></tr>
-<tr><td> <a href="full_index.html#r">r.*</a> </td><td>raster commands</td></tr>
-<tr><td> <a href="full_index.html#r3">r3.*</a> </td><td>raster3D commands</td></tr>
-<tr><td> <a href="full_index.html#t">t.*</a> </td><td>temporal commands</td></tr>
-<tr><td> <a href="full_index.html#v">v.*</a> </td><td>vector commands</td></tr>
-<tr><td> <a href="wxGUI.Nviz.html">nviz</a> </td><td>visualization suite</td></tr>
-<tr><td> <a href="wxGUI.html">wxGUI</a> </td><td>wxPython-based GUI frontend</td></tr>
-</table>
+toc = \
+r"""
+<div class="toc">
+<ul class="toc">
+<li class="toc"\><a class="toc" href="full_index.html#d">Display commands (d.*)</a></li>
+<li class="toc"\><a class="toc" href="full_index.html#db">Database commands (db.*)</a></li>
+<li class="toc"\><a class="toc" href="full_index.html#g">General commands (g.*)</a></li>
+<li class="toc"\><a class="toc" href="full_index.html#i">Imagery commands (i.*)</a></li>
+<li class="toc"\><a class="toc" href="full_index.html#m">Miscellaneous commands (m.*)</a></li>
+<li class="toc"\><a class="toc" href="full_index.html#ps">PostScript commands (ps.*)</a></li>
+<li class="toc"\><a class="toc" href="full_index.html#r">Raster commands (r.*)</a></li>
+<li class="toc"\><a class="toc" href="full_index.html#r3">3d raster commands (r3.*)</a></li>
+<li class="toc"\><a class="toc" href="full_index.html#t">Temporal commands (t.*)</a></li>
+<li class="toc"\><a class="toc" href="full_index.html#v">Vector commands (v.*)</a></li>
+<li class="toc"\><a class="toc" href="wxGUI.html">wxGUI Graphical User Interface</a></li>
+<li class="toc"\><a class="toc" href="wxGUI.nviz.html">3D visualization suite</a></li>
+</ul>
+</div>
"""
#"
@@ -229,9 +226,8 @@
full_index_header = \
-r"""Go <a href="index.html">back to help overview</a>
-<h3>Full command index:</h3>
-[
+r"""
+Go <a href="index.html">back to help overview</a>
"""
#"
@@ -335,12 +331,12 @@
not cmd.startswith("wxGUI."):
yield cmd
-def write_html_header(f, title, ismain = False):
+def write_html_header(f, title, ismain = False, body_width = "99%"):
f.write(header1_tmpl.substitute(title = title))
if ismain and macosx:
f.write(macosx_tmpl.substitute(grass_version = grass_version,
grass_mmver = grass_mmver))
- f.write(header2_tmpl.substitute(grass_version = grass_version))
+ f.write(header2_tmpl.substitute(grass_version = grass_version, body_width = body_width))
def write_html_cmd_overview(f):
box_color = "#e1ecd0"
More information about the grass-commit
mailing list