]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scripts/lilypond-book.py (Lilypond_file_snippet.my_system): add
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 3 May 2006 10:41:53 +0000 (10:41 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 3 May 2006 10:41:53 +0000 (10:41 +0000)
-f png for HTML, TEXINFO formats.

* input/tutorial/lbook-html-test.html: new file.

ChangeLog
input/tutorial/lbook-html-test.html [new file with mode: 0644]
scripts/lilypond-book.py

index b23980190d367e6231c09d8fa27f0807534674f2..a6f9a69592857ee9ad18b9cd89bc0714f06547e6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2006-05-03  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
+       * scripts/lilypond-book.py (Lilypond_file_snippet.my_system): add
+       -f png for HTML, TEXINFO formats.
+
+       * input/tutorial/lbook-html-test.html: new file.
+
        * lily/include/tie-formatting-problem.hh (class
        Tie_formatting_problem): index Chord_outline_map by Tuple2 for
        [column, direction]. This fixes laissez vibrer ties.
diff --git a/input/tutorial/lbook-html-test.html b/input/tutorial/lbook-html-test.html
new file mode 100644 (file)
index 0000000..a55d74d
--- /dev/null
@@ -0,0 +1,14 @@
+<html>
+<p>
+Documents for lilypond-book may freely mix music and text.  For
+example,
+<lilypond>
+\relative {
+  c2^"test" g'2 \times 2/3 { f8 e d } c'2 g4
+}
+</lilypond>
+
+<lilypond fragment quote staffsize=26 verbatim>
+  c'4 f16
+</lilypond>
+</html>
index 2faaa9c3bfdbd042911dd55eac047d40ad771a75..a61b5302d08e2415a6f1b7fa665f384e09b1f67e 100644 (file)
@@ -1068,16 +1068,17 @@ class Lilypond_snippet (Snippet):
 
     def png_is_outdated (self):
         base = self.basename ()
-        ok = self.ly_is_outdated ()
+        ok = not self.ly_is_outdated ()
         if global_options.format in (HTML, TEXINFO):
             ok = ok and os.path.exists (base + '.eps')
 
             page_count = 0
             if ok:
                 page_count = ps_page_count (base + '.eps')
-            
-            if page_count == 1:
+
+            if page_count <= 1:
                 ok = ok and os.path.exists (base + '.png')
+             
             elif page_count > 1:
                 for a in range (1, page_count + 1):
                         ok = ok and os.path.exists (base + '-page%d.png' % a)
@@ -1373,11 +1374,12 @@ def is_derived_class (cl, baseclass):
 
 def process_snippets (cmd, ly_snippets, texstr_snippets, png_snippets):
     ly_names = filter (lambda x: x,
-             map (Lilypond_snippet.basename, ly_snippets))
+                       map (Lilypond_snippet.basename, ly_snippets))
     texstr_names = filter (lambda x: x,
-             map (Lilypond_snippet.basename, texstr_snippets))
+                           map (Lilypond_snippet.basename, texstr_snippets))
+    
     png_names = filter (lambda x: x,
-              map (Lilypond_snippet.basename, png_snippets))
+                        map (Lilypond_snippet.basename, png_snippets))
 
     status = 0
     def my_system (cmd):
@@ -1385,12 +1387,15 @@ def process_snippets (cmd, ly_snippets, texstr_snippets, png_snippets):
                   be_verbose=global_options.verbose, 
                   progress_p= 1)
 
+    if global_options.format in (HTML, TEXINFO):
+        cmd += ' --format png '
+
     # UGH
     # the --process=CMD switch is a bad idea
     # it is too generic for lilypond-book.
     if texstr_names:
         my_system (string.join ([cmd, '--backend texstr',
-                    'snippet-map.ly'] + texstr_names))
+                                 'snippet-map.ly'] + texstr_names))
         for l in texstr_names:
             my_system ('latex %s.texstr' % l)
 
@@ -1507,27 +1512,25 @@ def do_process_cmd (chunks, input_name):
              chunks)
 
     write_file_map (all_lys, input_name)
-    ly_outdated = \
-     filter (lambda x: is_derived_class (x.__class__,
-                       Lilypond_snippet)
-              and x.ly_is_outdated (),
-         chunks)
-    texstr_outdated = \
-     filter (lambda x: is_derived_class (x.__class__,
-                       Lilypond_snippet)
-              and x.texstr_is_outdated (),
-         chunks)
-    png_outdated = \
-     filter (lambda x: is_derived_class (x.__class__,
-                       Lilypond_snippet)
-              and x.png_is_outdated (),
-         chunks)
-
+    ly_outdated = filter (lambda x: is_derived_class (x.__class__,
+                                                      Lilypond_snippet)
+                          and x.ly_is_outdated (), chunks)
+    texstr_outdated = filter (lambda x: is_derived_class (x.__class__,
+                                                          Lilypond_snippet)
+                              and x.texstr_is_outdated (),
+                              chunks)
+    png_outdated = filter (lambda x: is_derived_class (x.__class__,
+                                                        Lilypond_snippet)
+                           and x.png_is_outdated (),
+                           chunks)
+
+    outdated = png_outdated + texstr_outdated + ly_outdated
+    
     progress (_ ("Writing snippets..."))
     map (Lilypond_snippet.write_ly, ly_outdated)
     progress ('\n')
 
-    if ly_outdated:
+    if outdated:
         progress (_ ("Processing..."))
         progress ('\n')
         process_snippets (global_options.process_cmd, ly_outdated, texstr_outdated, png_outdated)