]> git.donarmstrong.com Git - lilypond.git/commitdiff
(classic_lilypond_book_compatibility): New function.
authorJan Nieuwenhuizen <janneke@gnu.org>
Thu, 5 Feb 2004 14:56:51 +0000 (14:56 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Thu, 5 Feb 2004 14:56:51 +0000 (14:56 +0000)
ChangeLog
scripts/filter-lilypond-book.py

index e554c4d39f47d4e836b0128003a4f2a035d9349a..c1996c1aae83432af7f28b25f743d944ba9ab9af 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-02-05  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * scripts/filter-lilypond-book.py
+       (classic_lilypond_book_compatibility): New function.
+
 2004-02-05  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
        * Grand 2003 -> 2004 search replace. 
@@ -74,7 +79,8 @@
 
        * lily/note-heads-engraver.cc (process_music): robustification.
 
-       * lily/accidental-engraver.cc (process_acknowledged_grobs): robustification.
+       * lily/accidental-engraver.cc (process_acknowledged_grobs):
+       robustification.
 
        * lily/parser.yy (simple_element): add \drums mode.
        (simple_element): remove \pitchnames , \chordmodifiers. Use
index cddefa43f0417310fb56e9fb44b3ab0da0d959cc..25c614c0e8a65107a7876ea370652a8b8c579de1 100644 (file)
@@ -287,6 +287,24 @@ FRAGMENT_LY = r'''\score{
 }'''
 FULL_LY = '%(code)s'
 
+def classic_lilypond_book_compatibility (o):
+       if o == 'singleline':
+               return 'raggedright'
+       m = re.search ('relative\s*([-0-9])', o)
+       if m:
+               return 'relative=%s' % m.group (1)
+       m = re.match ('([0-9]+)pt', o)
+       if m:
+               return 'staffsize=%s' % m.group (1)
+       m = re.match ('indent=([-.0-9]+)(cm|in|mm|pt)', o)
+       if m:
+               f = float (m.group (1))
+               return 'indent=%f\\%s' % (f, m.group (2))
+       m = re.match ('linewidth=([-.0-9]+)(cm|in|mm|pt)', o)
+       if m:
+               f = float (m.group (1))
+               return 'linewidth=%f\\%s' % (f, m.group (2))
+       return None
 
 def compose_ly (code, option_string):
        options = []
@@ -315,6 +333,13 @@ def compose_ly (code, option_string):
        paper_options = []
        preamble_options = []
        for i in options:
+               c = classic_lilypond_book_compatibility (i)
+               if c:
+                       ly.warning (_ ("deprecated ly-option used: %s" % i))
+                       ly.warning (_ ("compatibility mode translation: %s" \
+                                      % c))
+                       i = c
+               
                if string.find (i, '=') > 0:
                        key, value = string.split (i, '=')
                        # hmm