[gtk-doc] db2html: some cleanup and planning



commit ab167080ada8e6bc871a337903e0b326b9ea6a2d
Author: Stefan Sauer <ensonic users sf net>
Date:   Wed Feb 14 07:51:44 2018 +0100

    db2html: some cleanup and planning
    
    Reuse the nav_home var and remove the page specific vars.
    
    Add some comments for further refinement.

 tools/db2html.py          |   23 +++++++++++++----------
 tools/templates/book.html |    2 +-
 2 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/tools/db2html.py b/tools/db2html.py
index 968c1e4..c8c9121 100644
--- a/tools/db2html.py
+++ b/tools/db2html.py
@@ -530,14 +530,12 @@ def convert(out_dir, files, node):
             if ix < len(files) - 1:
                 params['nav_next'] = files[ix + 1]
 
-            # page specific vars
-            # TODO: extract into functions?
-            if node.name == 'book':
-                params['toc'] = node.root
-            elif node.name == 'refsect':
-                # TODO: toc params from xml
-                # all refsect1 + refsect1/title/text() from xml
-                pass
+            # TODO: call a top-level python converter instead
+            # generate_{book,chapter,index,refentry}(files, node)
+            # xml is node.xml
+            # We need to rewrite all other converters to take
+            # (xml, files, node) or (xml, params)
+            # where params is sort of like what we have above
 
             html.write(template.render(**params))
         else:
@@ -562,15 +560,20 @@ def main(index_file):
         if e.errno != errno.EEXIST:
             raise
 
-    # We need two passes:
+    # We need multiple passes:
     # 1) recursively walk the tree and chunk it into a python tree so that we
-    #   can generate navigation and link tags
+    #   can generate navigation and link tags.
+    #   also collect all 'id' attributes on the way and build map of
+    #   id:rel-link (in fixxref is is Links[])
     files = chunk(tree.getroot())
     # 2) iterate the tree and output files
     # TODO: use multiprocessing
     files = list(PreOrderIter(files))
     for node in files:
         convert(out_dir, files, node)
+    # 3) create a devhelp2.xsl
+    # - toc under 'chapter'
+    # - keywords under 'functions' from all refsect2 and refsect3
 
 
 if __name__ == '__main__':
diff --git a/tools/templates/book.html b/tools/templates/book.html
index 58e32f3..df315ae 100644
--- a/tools/templates/book.html
+++ b/tools/templates/book.html
@@ -19,7 +19,7 @@
 </div>
 <div class="toc">
   <dl class="toc">
-  {%- for item in toc.children recursive %}
+  {%- for item in nav_home.children recursive %}
       <dt><a href="{{ item.filename|e }}">{{ item.title }}</a>
       {%- if item.children -%}
           <dd><dl>{{ loop(item.children) }}</dl></dd>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]