]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-book.py
Doc -- Learning -- typo: extra space
[lilypond.git] / scripts / lilypond-book.py
index 276c2aae509b42794145f9f05fd7d572fc600425..392ddd061ebcbf3dabdda25cf7367fb787f32026 100644 (file)
@@ -1,5 +1,20 @@
 #!@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:
 
@@ -1116,6 +1131,17 @@ class LilypondSnippet (Snippet):
         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
@@ -1227,7 +1253,9 @@ class LilypondSnippet (Snippet):
             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]