]> git.donarmstrong.com Git - lilypond.git/commitdiff
(Snippet.output_print_filename): new
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 6 Feb 2004 21:16:10 +0000 (21:16 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 6 Feb 2004 21:16:10 +0000 (21:16 +0000)
file, process printfilename option.
(Snippet.__init__): rewrite: do not use global variables h or
index.
(main): really support -I option.
(find_toplevel_snippets): new code.
(find_toplevel_snippets): reinstate old version, without global variables.

scripts/lilypond-book.py

index e7db3fdac9269e0ca19804794aac090ac2070a5d..e2b09713d9bc30fdc04bc18094569d1556599f30 100644 (file)
@@ -523,10 +523,10 @@ def find_toplevel_snippets (infile, outfile, types):
        # without searching the string multiple times for one regex.
        #
        # Hence, we use earlier results to limit the string portion
-       # where we search. We're hosed if the first type only occurs
-       # at the end of the string, since it  will then use quadratic
-       # time.
-       #
+       # where we search.
+       # Since every part of the string is traversed at most once for
+       # every type of snippet, this is linear.
+       
        
         while 1:
                 first = None
@@ -551,16 +551,13 @@ def find_toplevel_snippets (infile, outfile, types):
                 snippets.append (found[first])
 
                outfile.write (s[index:index + found[first].start (0)])
-               outfile.write (found[first].replacement_text ())
+               outfile.write (found[first].replacement_text (format))
                
                 index += found[first].end (0)
 
         return snippets
 
 
-
-
-
 def filter_pipe (input, cmd):
        if verbose_p:
                ly.progress (_ ("Opening filter `%s\'") % cmd)