From 096862f10c80d8d6bf2fe9bb2fd30c47e5ac7c91 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 5 Feb 2004 14:56:51 +0000 Subject: [PATCH] (classic_lilypond_book_compatibility): New function. --- ChangeLog | 8 +++++++- scripts/filter-lilypond-book.py | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e554c4d39f..c1996c1aae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-02-05 Jan Nieuwenhuizen + + * scripts/filter-lilypond-book.py + (classic_lilypond_book_compatibility): New function. + 2004-02-05 Han-Wen Nienhuys * 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 diff --git a/scripts/filter-lilypond-book.py b/scripts/filter-lilypond-book.py index cddefa43f0..25c614c0e8 100644 --- a/scripts/filter-lilypond-book.py +++ b/scripts/filter-lilypond-book.py @@ -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 -- 2.39.5