]> git.donarmstrong.com Git - lilypond.git/blobdiff - python/book_snippets.py
Fix 1214: Don't crash with \relative c' \new Voice {...}
[lilypond.git] / python / book_snippets.py
index a1b1328c575b4be2af6afe92c07d09183b9b1870..b7c3ddf0d67d369acfec84b3db605a54860b4db9 100644 (file)
@@ -53,6 +53,7 @@ NOTIME = 'notime'
 OUTPUT = 'output'
 OUTPUTIMAGE = 'outputimage'
 PAPER = 'paper'
+PAPERSIZE = 'papersize'
 PREAMBLE = 'preamble'
 PRINTFILENAME = 'printfilename'
 QUOTE = 'quote'
@@ -112,6 +113,7 @@ snippet_options = {
 
     ##
     PAPER: {
+        PAPERSIZE: r'''#(set-paper-size "%(papersize)s")''',
         INDENT: r'''indent = %(indent)s''',
         LINE_WIDTH: r'''line-width = %(line-width)s''',
         QUOTE: r'''line-width = %(line-width)s - 2.0 * %(exampleindent)s''',
@@ -553,6 +555,12 @@ left-margin-default right-margin-default)"
         elif relative > 0:
             relative_quotes += "'" * relative
 
+        # put paper-size first, if it exists
+        for i,elem in enumerate(compose_dict[PAPER]):
+            if elem.startswith("#(set-paper-size"):
+                compose_dict[PAPER].insert(0, compose_dict[PAPER].pop(i))
+                break
+
         paper_string = '\n  '.join (compose_dict[PAPER]) % override
         layout_string = '\n  '.join (compose_dict[LAYOUT]) % override
         notes_string = '\n  '.join (compose_dict[NOTES]) % vars ()