]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.117
authorfred <fred>
Wed, 27 Mar 2002 00:34:37 +0000 (00:34 +0000)
committerfred <fred>
Wed, 27 Mar 2002 00:34:37 +0000 (00:34 +0000)
scripts/lilypond-book.py

index 4d6b0e58f83601d6ea478becec9584244d4f7851..0634dad0ab9a61c9be72a7610dc87427964613e0 100644 (file)
@@ -805,8 +805,6 @@ def schedule_lilypond_block (chunk):
                else:
                        s = 'output-tex'
        else: # format == 'texi'
-               if os.path.isfile (pathbase + '.texidoc'):
-                       newbody = newbody + '\n@include %s.texidoc' % basename
                s = 'output-all'
        newbody = newbody + get_output (s) % {'fn': basename }
        return ('lilypond', newbody, opts, todo, basename)
@@ -999,6 +997,30 @@ Distributed under terms of the GNU General Public License. It comes with
 NO WARRANTY.
 """)
 
+
+def check_texidoc (chunks):
+       n = []
+        for c in chunks:
+               if c[0] == 'lilypond':
+                       (type, body, opts, todo, basename) = c;
+                       pathbase = os.path.join (g_outdir, basename)
+                       if os.path.isfile (pathbase + '.texidoc'):
+                               body = '\n@include %s.texidoc' % basename + body
+                               c = (type, body, opts, todo, basename)
+               n.append (c)
+       return n
+
+def fix_epswidth (chunks):
+       newchunks = []
+       for c in chunks:
+               if c[0] == 'lilypond' and 'eps' in c[2]:
+                       body = re.sub (r"""\\lilypondepswidth{(.*?)}""", find_eps_dims, c[1])
+                       # why do we junk opts, todo, basename?
+                       new_chunk = (('lilypond', body))
+               newchunks.append (c)
+       return newchunks
+
+
 def do_file(input_filename):
        file_settings = {}
        if outname:
@@ -1019,18 +1041,15 @@ def do_file(input_filename):
        #sys.exit()
        scan_preamble(chunks)
        chunks = process_lilypond_blocks(my_outname, chunks)
+
        # Do It.
        if __main__.g_run_lilypond:
                compile_all_files (chunks)
-               newchunks = []
-               # finishing touch.
-               for c in chunks:
-                       if c[0] == 'lilypond' and 'eps' in c[2]:
-                               body = re.sub (r"""\\lilypondepswidth{(.*?)}""", find_eps_dims, c[1])
-                               newchunks.append (('lilypond', body))
-                       else:
-                               newchunks.append (c)
-               chunks = newchunks
+               chunks = fix_epswidth (chunks)
+
+       if __main__.format == 'texi':
+               chunks = check_texidoc (chunks)
+
        x = 0
        chunks = completize_preamble (chunks)
        foutn = os.path.join(g_outdir, my_outname + '.' + format)