[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lilypond-book: Group line-width settings together (issue 2222). (issue 5
From: |
julien . rioux |
Subject: |
lilypond-book: Group line-width settings together (issue 2222). (issue 5553056) |
Date: |
Thu, 19 Jan 2012 00:17:18 +0000 |
Reviewers: Reinhold,
Message:
Please review.
Description:
lilypond-book:
Group line-width settings together (issue 2222).
Also, specify filename and ext for all snippets.
Please review this at http://codereview.appspot.com/5553056/
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
e5a43110ffa268ae6733d09e7c96dc768503ef61..127453d6afa6f79c9c84db7e6792926f9001a8f0
100644
--- a/python/book_snippets.py
+++ b/python/book_snippets.py
@@ -109,11 +109,19 @@ snippet_options = {
},
##
+ # TODO: Remove the 1mm additional padding in the line-width
+ # once lilypond creates tighter cropped images!
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''',
+ LINE_WIDTH: r'''line-width = %(line-width)s
+ %% offset the left padding, also add 1mm as lilypond creates cropped
+ %% images with a little space on the right
+ line-width = #(- line-width (* mm %(padding_mm)f) (* mm 1))''',
+ QUOTE: r'''line-width = %(line-width)s - 2.0 * %(exampleindent)s
+ %% offset the left padding, also add 1mm as lilypond creates cropped
+ %% images with a little space on the right
+ line-width = #(- line-width (* mm %(padding_mm)f) (* mm 1))''',
RAGGED_RIGHT: r'''ragged-right = ##t''',
NORAGGED_RIGHT: r'''ragged-right = ##f''',
},
@@ -164,8 +172,6 @@ def classic_lilypond_book_compatibility (key, value):
return (None, None)
-# TODO: Remove the 1mm additional padding in the line-width, once lilypond
-# creates tighter cropped images!
PREAMBLE_LY = '''%%%% Generated by %(program_name)s
%%%% Options: [%(option_string)s]
\\include "lilypond-book-preamble.ly"
@@ -179,9 +185,6 @@ PREAMBLE_LY = '''%%%% Generated by %(program_name)s
\paper {
%(paper_string)s
- %% offset the left padding, also add 1mm as lilypond creates cropped
- %% images with a little space on the right
- line-width = #(- line-width (* mm %(padding_mm)f) (* mm 1))
}
\layout {
@@ -329,6 +332,8 @@ class IncludeSnippet (Snippet):
class LilypondSnippet (Snippet):
def __init__ (self, type, match, formatter, line_number,
global_options):
Snippet.__init__ (self, type, match, formatter, line_number,
global_options)
+ self.filename = ''
+ self.ext = '.ly'
os = match.group ('options')
self.parse_snippet_options (os, self.type)
@@ -498,6 +503,7 @@ class LilypondSnippet (Snippet):
override[EXAMPLEINDENT] = r'0.4\in'
override[LINE_WIDTH] = '5\\in'
override.update (self.formatter.default_snippet_options)
+ override['padding_mm'] = self.global_options.padding_mm
option_string = ','.join (self.get_outputrelevant_option_strings
())
compose_dict = {}
@@ -651,7 +657,10 @@ printing diff against existing file." % filename)
def additional_files_to_consider (self, base, full):
return []
def additional_files_required (self, base, full):
- return []
+ result = [];
+ if self.ext != '.ly':
+ result.append (base + self.ext)
+ return result
def all_output_files (self, output_dir, output_dir_files):
@@ -803,7 +812,6 @@ class LilypondFileSnippet (LilypondSnippet):
def __init__ (self, type, match, formatter, line_number,
global_options):
LilypondSnippet.__init__ (self, type, match, formatter,
line_number, global_options)
self.filename = self.substring ('filename')
- self.ext = os.path.splitext (os.path.basename (self.filename))[1]
self.contents = file (BookBase.find_file (self.filename,
global_options.include_path,
global_options.original_dir)).read ()
@@ -838,6 +846,7 @@ class MusicXMLFileSnippet (LilypondFileSnippet):
LilypondFileSnippet.__init__ (self, type, match, formatter,
line_number, global_options)
self.compressed = False
self.converted_ly = None
+ self.ext = os.path.splitext (os.path.basename (self.filename))[1]
self.musicxml_options_dict = {
'verbose': '--verbose',
'lxml': '--lxml',
@@ -881,14 +890,6 @@ class MusicXMLFileSnippet (LilypondFileSnippet):
return ('\\sourcefilename \"%s\"\n\\sourcefileline 0\n%s'
% (name, self.converted_ly))
- def additional_files_required (self, base, full):
- result = [];
- if self.compressed:
- result.append (base + '.mxl')
- else:
- result.append (base + '.xml')
- return result
-
def write_ly (self):
base = self.basename ()
path = os.path.join (self.global_options.lily_output_dir, base)
- lilypond-book: Group line-width settings together (issue 2222). (issue 5553056),
julien . rioux <=
- Re: lilypond-book: Group line-width settings together (issue 2222). (issue 5553056), Carl . D . Sorensen, 2012/01/18
- Re: lilypond-book: Group line-width settings together (issue 2222). (issue 5553056), graham, 2012/01/20
- Re: lilypond-book: Group line-width settings together (issue 2222). (issue 5553056), janek . lilypond, 2012/01/21
- Re: lilypond-book: Group line-width settings together (issue 2222). (issue 5553056), graham, 2012/01/21
- Re: lilypond-book: Group line-width settings together (issue 2222). (issue 5553056), julien . rioux, 2012/01/21
- Re: lilypond-book: Group line-width settings together (issue 2222). (issue 5553056), janek . lilypond, 2012/01/21
- Re: lilypond-book: Group line-width settings together (issue 2222). (issue 5553056), janek . lilypond, 2012/01/21
- Re: lilypond-book: Group line-width settings together (issue 2222). (issue 5553056), reinhold . kainhofer, 2012/01/21