[GRASS-SVN] r59691 - grass/trunk/tools
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Apr 11 05:57:55 PDT 2014
Author: martinl
Date: 2014-04-11 05:57:55 -0700 (Fri, 11 Apr 2014)
New Revision: 59691
Modified:
grass/trunk/tools/mkhtml.py
Log:
fix mkhtml.py when h3 has no parent (h2)
Modified: grass/trunk/tools/mkhtml.py
===================================================================
--- grass/trunk/tools/mkhtml.py 2014-04-11 12:38:43 UTC (rev 59690)
+++ grass/trunk/tools/mkhtml.py 2014-04-11 12:57:55 UTC (rev 59691)
@@ -121,19 +121,25 @@
fd = sys.stdout
fd.write('<table class="toc">\n')
ul = False
+ ul_parent = False
for tag, href, text in data:
if tag == 'h3':
- if not ul:
- fd.write('<tr><td><ul class="toc">\n')
- ul = True
- fd.write('<li class="toc"><a href="#%s" class="toc">%s</a></li>\n' % \
+ if ul_parent:
+ if not ul:
+ fd.write('<tr><td><ul class="toc">\n')
+ ul = True
+ fd.write('<li class="toc"><a href="#%s" class="toc">%s</a></li>\n' % \
+ (href, text))
+ continue
+
+ if tag == 'h2' and not ul_parent:
+ ul_parent = True
+
+ if ul:
+ fd.write('</ul></td></tr>\n')
+ ul = False
+ fd.write('<tr><td> <a href="#%s" class="toc">%s</a></td></tr>\n' % \
(href, text))
- else:
- if ul:
- fd.write('</ul></td></tr>\n')
- ul = False
- fd.write('<tr><td> <a href="#%s" class="toc">%s</a></td></tr>\n' % \
- (href, text))
fd.write('</table>\n')
More information about the grass-commit
mailing list