From: janneke <janneke>
Date: Thu, 5 Feb 2004 14:56:51 +0000 (+0000)
Subject: (classic_lilypond_book_compatibility): New function.
X-Git-Tag: release/2.1.19~3
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=9876ac260abb5d998ac1716933a727376b2c59ad;p=lilypond.git

(classic_lilypond_book_compatibility): New function.
---

diff --git a/ChangeLog b/ChangeLog
index e554c4d39f..c1996c1aae 100644
--- 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
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