#!@TARGET_PYTHON@
+# This file is part of LilyPond, the GNU music typesetter.
+#
+# LilyPond is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# LilyPond is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
+
'''
Example usage:
if not INDENT in self.option_dict:
self.option_dict[INDENT] = '0\\mm'
+ # Set a default line-width if there is none. We need this, because
+ # lilypond-book has set left-padding by default and therefore does
+ # #(define line-width (- line-width (* 3 mm)))
+ # TODO: Junk this ugly hack if the code gets rewritten to concatenate
+ # all settings before writing them in the \paper block.
+ if not LINE_WIDTH in self.option_dict:
+ if not QUOTE in self.option_dict:
+ if not LILYQUOTE in self.option_dict:
+ self.option_dict[LINE_WIDTH] = "#(- paper-width \
+left-margin-default right-margin-default)"
+
def compose_ly (self, code):
if FRAGMENT in self.option_dict:
body = FRAGMENT_LY
except ImportError:
from md5 import md5
- hash = md5 (self.relevant_contents (self.full_ly ()))
+ # We only want to calculate the hash based
+ # on the snippet code, not the snippet + preamble
+ hash = md5 (self.relevant_contents (self.ly ()))
## let's not create too long names.
self.checksum = hash.hexdigest ()[:10]
os.unlink (logfile)
columns = 0
- m = re.search ('columns=([0-9.]*)', parameter_string)
+ m = re.search ('columns=([0-9.]+)', parameter_string)
if m:
columns = int (m.group (1))
columnsep = 0
- m = re.search ('columnsep=([0-9.]*)pt', parameter_string)
+ m = re.search ('columnsep=([0-9.]+)pt', parameter_string)
if m:
columnsep = float (m.group (1))
textwidth = 0
- m = re.search ('textwidth=([0-9.]*)pt', parameter_string)
+ m = re.search ('textwidth=([0-9.]+)pt', parameter_string)
if m:
textwidth = float (m.group (1))
if columns: