]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/build/extract_texi_filenames.py
Add '-dcrop' option to ps and svg backends
[lilypond.git] / scripts / build / extract_texi_filenames.py
index 7dd41eeadec97e851683faaeb97b872a830291fd..9e338b5daf0f26312c7b5c6ddf55cd80a5ea859d 100644 (file)
@@ -111,11 +111,12 @@ if not os.path.isdir (outdir):
         os.unlink (outdir)
     os.makedirs (outdir)
 
-include_re = re.compile (r'@include ((?!../lily-).*?\.i?te(xi|ly))$', re.M)
+# Only look at @include if it is not preceeded by a @c:
+include_re = re.compile (r'^(?!.*@c .*@include)@include ((?!../lily-).*?\.i?te(xi|ly))$', re.M)
 whitespaces = re.compile (r'\s+')
 section_translation_re = re.compile ('^@(node|(?:unnumbered|appendix)\
 (?:(?:sub){0,2}sec)?|top|chapter|(?:sub){0,2}section|\
-(?:major|chap|(?:sub){0,2})heading|lydoctitle|translationof) \
+(?:major|chap|(?:sub){0,2})heading|lydoctitle|translationof|nodeprefix) \
 (.+)$', re.MULTILINE)
 external_node_re = re.compile (r'\s+@c\s+external.*')
 
@@ -131,8 +132,8 @@ def expand_includes (m, filename):
                 return extract_sections (filepath)[1]
         if not (include_name in known_missing_files):
             # Not found
-            print 'No such file: ' + include_name
-            print 'Search path: ' + ':'.join (include_path)
+            print 'Warning: No such file: ' + include_name + \
+                  ' (search path: ' + ':'.join (include_path)+')'
         return ''
 
 lang_re = re.compile (r'^@documentlanguage (.+)', re.M)
@@ -225,6 +226,7 @@ def process_sections (filename, lang_suffix, page):
         print 'writing:', p
     f = open (p, 'w')
 
+    node_prefix_title = ''
     this_title = ''
     this_filename = 'index'
     this_anchor = ''
@@ -259,6 +261,9 @@ def process_sections (filename, lang_suffix, page):
                 this_filename = anchor
             elif original_node in initial_map:
                 this_filename = initial_map[original_node][2]
+        elif sec[0] == "nodeprefix":
+            node_prefix_title = remove_texinfo (sec[1])
+            node_prefix_anchor = create_texinfo_anchor (sec[1])
         else:
             # Some pages might not use a node for every section, so
             # treat this case here, too: If we already had a section
@@ -270,6 +275,10 @@ def process_sections (filename, lang_suffix, page):
                 this_anchor = create_texinfo_anchor (sec[1])
             had_section = True
 
+            if sec[0] == "lydoctitle" and node_prefix_title:
+                this_title = "%s: %s" % (node_prefix_title, this_title)
+                this_anchor = "%s-%s" % (node_prefix_anchor, this_anchor)
+
             if split == 'custom':
                 # unnumbered nodes use the previously used file name,
                 # only numbered nodes get their own filename! However,