]> git.donarmstrong.com Git - lilypond.git/commitdiff
texi2html: handle sections without node; top-level unnumbered get their own file
authorReinhold Kainhofer <reinhold@kainhofer.com>
Tue, 5 Aug 2008 18:42:57 +0000 (20:42 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Tue, 5 Aug 2008 18:42:57 +0000 (20:42 +0200)
buildscripts/extract_texi_filenames.py

index e93dc2317de59e8eae139ae9980825cfc51c100b..ec7a42dc21c0a62e6e10f7ff430ef7fd6e8aad38 100755 (executable)
@@ -111,11 +111,13 @@ def process_sections (filename, page):
     this_filename = ''
     this_anchor = ''
     this_unnumbered = False
+    had_section = False
     for sec in sections:
         if sec[0] == "node":
             # Write out the cached values to the file and start a new section:
             if this_title != '':
                 f.write (this_title + "\t" + this_filename + "\t" + this_anchor + "\n")
+                had_section = False
             this_title = remove_texinfo (sec[1])
             this_anchor = create_texinfo_anchor (sec[1])
         elif sec[0] == "translationof":
@@ -126,10 +128,21 @@ def process_sections (filename, page):
             if not this_unnumbered:
                 this_filename = anchor
         else:
+            # Some pages might not use a node for every section, so treat this
+            # case here, too: If we already had a section and encounter enother
+            # one before the next @node, we write out the old one and start
+            # with the new values
+            if had_section and this_title != '':
+                f.write (this_title + "\t" + this_filename + "\t" + this_anchor + "\n")
+                this_title = remove_texinfo (sec[1])
+                this_anchor = create_texinfo_anchor (sec[1])
+            had_section = True
+
             # unnumbered nodes use the previously used file name, only numbered
-            # nodes get their own filename!
+            # nodes get their own filename! However, top-level @unnumbered
+            # still get their own file.
             this_unnumbered = unnumbered_re.match (sec[0])
-            if not this_unnumbered:
+            if not this_unnumbered or sec[0] == "unnumbered":
                 this_filename = this_anchor
 
     if this_title != '':