[GRASS-SVN] r59806 - in grass/trunk: man tools

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Apr 19 10:44:15 PDT 2014


Author: martinl
Date: 2014-04-19 10:44:14 -0700 (Sat, 19 Apr 2014)
New Revision: 59806

Modified:
   grass/trunk/man/grassdocs.css
   grass/trunk/tools/mkhtml.py
Log:
Manual pages: avoid <table> tag in TOC 


Modified: grass/trunk/man/grassdocs.css
===================================================================
--- grass/trunk/man/grassdocs.css	2014-04-19 17:43:23 UTC (rev 59805)
+++ grass/trunk/man/grassdocs.css	2014-04-19 17:44:14 UTC (rev 59806)
@@ -88,7 +88,7 @@
     padding: 5px;
 }
 
-table.toc{
+div.toc{
     background-color: transparent;
     position: fixed;
     border: solid 1px rgb(25%, 60%, 25%);
@@ -103,11 +103,13 @@
 
 li.toc {
    margin-left: -15px;
+   padding: 3px 3px; 3px; 3px;
    color: rgb(25%, 60%, 25%);
 }
 
 ul.toc {
-   margin-bottom: 0px;
+   margin-top: 3px;
+   margin-bottom: 3px;
 }
 
 a.toc {

Modified: grass/trunk/tools/mkhtml.py
===================================================================
--- grass/trunk/tools/mkhtml.py	2014-04-19 17:43:23 UTC (rev 59805)
+++ grass/trunk/tools/mkhtml.py	2014-04-19 17:44:14 UTC (rev 59806)
@@ -119,30 +119,31 @@
 
 def write_toc(data):
     fd = sys.stdout
-    fd.write('<table class="toc">\n')
-    ul = False
-    ul_parent = False
+    fd.write('<div class="toc">\n')
+    fd.write('<ul class="toc">\n')
+    first = True
+    in_h3 = False
+    indent = 4
     for tag, href, text in data:
-        if tag == 'h3':
-            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 tag == 'h3' and not in_h3:
+            fd.write('\n%s<ul class="toc">\n' % (' ' * indent))
+            indent += 4
+            in_h3 = True
+        elif not first:
+            fd.write('</li>\n')
             
-        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')
+        if tag == 'h2' and in_h3:
+            indent -= 4
+            fd.write('%s</ul></li>\n' % (' ' * indent))
+            in_h3 = False
+        
+        fd.write('%s<li class="toc"><a href="#%s" class="toc">%s</a>' % \
+                     (' ' * indent, href, text))
+        first = False
+    
+    fd.write('</li>\n</ul>\n')
+    fd.write('</div>\n')
 
-
 def update_toc(data):
     ret_data = []
     pat = re.compile(r'(<(h\d)>)(.+)(</h\d>)')



More information about the grass-commit mailing list