lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lilypond-book: add [pagesize=xyz] option. (issue4239048)


From: percival . music . ca
Subject: lilypond-book: add [pagesize=xyz] option. (issue4239048)
Date: Mon, 28 Feb 2011 09:07:23 +0000

Reviewers: ,

Message:
We've had a doc editor doing bugger-all for the past two weeks because
nobody cooked up this 8-line python patch.

Please review.  I'm pushing it in 24 hours unless somebody screams.

Description:
lilypond-book: add [pagesize=xyz] option.

This will be *extremely* useful when writing
Notation 4 Spacing issues.

CG: add info about git rebase -i.

Please review this at http://codereview.appspot.com/4239048/

Affected files:
  M python/book_snippets.py


Index: python/book_snippets.py
diff --git a/python/book_snippets.py b/python/book_snippets.py
index a1b1328c575b4be2af6afe92c07d09183b9b1870..b7c3ddf0d67d369acfec84b3db605a54860b4db9 100644
--- a/python/book_snippets.py
+++ b/python/book_snippets.py
@@ -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 ()





reply via email to

[Prev in Thread] Current Thread [Next in Thread]