[gtk-doc] db2html: add delimiters between refsect2 blocks



commit 2c4a0499d83edc230c5bb1897d918c112a522210
Author: Stefan Sauer <ensonic users sf net>
Date:   Sun Jan 14 13:01:12 2018 +0100

    db2html: add delimiters between refsect2 blocks

 tools/db2html.py |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/tools/db2html.py b/tools/db2html.py
index 6e1d023..f5e0381 100644
--- a/tools/db2html.py
+++ b/tools/db2html.py
@@ -208,7 +208,7 @@ def convert__unknown(xml):
     return result
 
 
-def convert_refsect(xml, h_tag):
+def convert_refsect(xml, h_tag, inner_func=convert__inner):
     result = '<div class="%s">\n' % xml.tag
     title = xml.find('title')
     if title is not None:
@@ -218,7 +218,7 @@ def convert_refsect(xml, h_tag):
         xml.remove(title)
     if xml.text:
         result += xml.text
-    result += convert__inner(xml)
+    result += inner_func(xml)
     result += '</div>'
     if xml.tail:
         result += xml.tail
@@ -303,7 +303,17 @@ def convert_programlisting(xml):
 
 
 def convert_refsect1(xml):
-    return convert_refsect(xml, 'h2')
+    # Add a divider between two consequitive refsect2
+    def convert_inner(xml):
+        result = []
+        prev = None
+        for child in xml:
+            if child.tag == 'refsect2' and prev is not None and prev.tag == child.tag:
+                result.append('<hr>\n')
+            result.append(convert_tags.get(child.tag, convert__unknown)(child))
+            prev = child
+        return ''.join(result)
+    return convert_refsect(xml, 'h2', convert_inner)
 
 
 def convert_refsect2(xml):


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