]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-book.py
* scripts/lilypond-book.py (do_file): put texidoc before image.
[lilypond.git] / scripts / lilypond-book.py
index fa1c65f8bc609fd055163ea93c609a483ff42854..e9a133338e511b4a609acb71ce54f9839a0a7d75 100644 (file)
@@ -1157,20 +1157,28 @@ def format_lilypond_block (chunk):
                s = 'output-html'
 
        def html_pages (basename):
-               files =  glob.glob ("%s-page*.png"%  basename)
-
+               pat = os.path.join (g_outdir, "%s-page*.png"%  basename)
+               
+               files =  glob.glob (pat)
+               
+               
                template = '''<img align="center" valign="center"
                border="0" src="%s" alt="[picture of music]">'''
 
                str = ''
-               if not files:
+               if  files == []:
                        files = [basename+'.png' ]
-               for  f in  files:
+               else:
+                       files = map (os.path.basename, files)
+                       
+               for f in  files:
                        str += template % f
 
                str = '<a href="%s.ly">%s</a>' % (basename, str)
+
                return str
 
+       
        newbody = newbody + get_output (s) % {'fn': basename,
                                              'htmlimages': html_pages(basename)
                                              }
@@ -1234,7 +1242,10 @@ linking to the menu.
                changed = update_file (content, outname)
 
                preview = base + ".png"
-               if changed or not os.path.isfile (preview):
+               preview_page = base + '-page1.png'
+               
+               if changed or not (os.path.isfile (preview) or
+                                  os.path.isfile (preview_page)):
                        
                        ly.system ('%s --preview --postscript --verbose %s ' % (ly2dvi_binary, base) ) 
 
@@ -1432,8 +1443,7 @@ def check_texidoc (chunks):
                        pathbase = os.path.join (g_outdir, basename)
                        if os.path.isfile (pathbase + '.texidoc') \
                           and 'notexidoc' not in opts:
-                               body = '\n@include %s.texidoc\n' % basename + body
-                               c = (type, body, opts, todo, basename)
+                               n.append( ('input', '\n@include %s.texidoc\n' % basename))
                n.append (c)
        return n
 
@@ -1489,12 +1499,12 @@ def do_file (input_filename):
                compile_all_files (chunks)
                chunks = fix_epswidth (chunks)
 
+
+       chunks = format_lilypond_output_bodies (chunks)
        global format
        if format == 'texi':
                chunks = check_texidoc (chunks)
 
-       chunks = format_lilypond_output_bodies (chunks)
-
 
        x = 0
        chunks = completize_preamble (chunks)