#
# source file of the GNU LilyPond music typesetter
#
-# (c) 1998--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+# (c) 1998--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
# Jan Nieuwenhuizen <janneke@gnu.org>
-
-# TODO
-# use -f and -t for -s output
-
-# NEWS
-# 0.2
-# - rewrite in python
-
import os
import sys
import __main__
def conv (str):
+ str = re.sub (r'(\\property[^=]+)=\s*([-0-9]+)',
+ r'\1= #\2', str)
str = re.sub (r'\\property\s+([^. ]+)\s*\.\s*([^\\=]+)\s*\\(set|override)',
r"\\overrid@ \1.\2 ", str)
str = re.sub (r'\\property\s+([^. ]+)\s*\.\s*([^\\= ]+)\s*=\s*',
'''\\apply -> \\applymusic'''))
def conv (str):
+ if re.search ('textheight', str):
+ sys.stderr.write("\nWarning: tuning of page layout has changed. See reference manual.\n")
+
str = re.sub (r'\\OrchestralScoreContext', '\\Score', str)
def func(m):
if m.group(1) not in ['RemoveEmptyStaff',
+def conv (str):
+ str = re.sub (r'lastpagefill\s*=\s*"?1"', 'raggedlastbottom = ##t', str)
+ return str
+
+conversions.append (((2, 3, 6), conv,
+ '''lastpagefill -> raggedlastbottom'''))
+
+
+
def conv (str):
str = re.sub (r'\\consistsend', '\\consists', str)
str = re.sub (r'\\lyricsto\s+("?[a-zA-Z]+"?)(\s*\\new Lyrics\s*)?\\lyrics',
def conv (str):
str = re.sub (r'\\addlyrics', r'\\oldaddlyrics', str)
str = re.sub (r'\\newlyrics', r'\\addlyrics', str)
+ if re.search (r"\\override\s*TextSpanner", str):
+ sys.stderr.write ("\nWarning: TextSpanner has been split into DynamicTextSpanner and TextSpanner\n")
return str
conversions.append (((2, 3, 10), conv,
str = re.sub ('soloADue', 'printPartCombineTexts', str)
str = re.sub (r'\\applymusic\s*#notes-to-clusters',
'\\makeClusters', str)
+
+ str = re.sub (r'pagenumber\s*=', 'firstpagenumber', str)
return str
conversions.append (((2, 3, 12), conv,
def conv (str):
str = re.sub (r'\\paper', r'\\layout', str)
str = re.sub (r'\\bookpaper', r'\\paper', str)
- str = re.sub (r'paper-set-staff-size', r'layout-set-staff-size', str)
+ if re.search ('paper-set-staff-size', str):
+ sys.stderr.write ('''\nWarning: staff size should be changed at top-level
+with
+
+ #(set-global-staff-size <STAFF-HEIGHT-IN-POINT>)
+
+''')
+
+
+ str = re.sub (r'#\(paper-set-staff-size', '%Use set-global-staff-size at toplevel\n% #(layout-set-staff-size', str)
return str
conversions.append (((2, 3, 22),
'''paper -> layout
bookpaper -> paper''' ))
+
+def conv (str):
+ str = re.sub (r'\\context\s+([a-zA-Z]+)\s*=\s*([a-z]+)\s',
+ r'\\context \1 = "\2" ',
+ str )
+ return str
+
+conversions.append (((2, 3, 23),
+ conv,
+ '''\context Foo = NOTENAME -> \context Foo = "NOTENAME"'''))
+
+def conv (str):
+ def sub(m):
+ return regularize_id (m.group (1))
+ str = re.sub (r'(maintainer_email|maintainer_web|midi_stuff|gourlay_maxmeasures)',
+ sub, str)
+ return str
+
+conversions.append (((2, 3, 24),
+ conv,
+ '''regularize other identifiers.'''))
+
+
+def conv (str):
+ return str
+
+conversions.append (((2, 4, 0),
+ conv,
+ ''))
+
+
+def conv (str):
+ str = re.sub (r'\\quote\s+"?([a-zA-Z0-9]+)"?\s+([0-9.*/]+)',
+ r'\\quoteDuring #"\1" { \skip \2 }',
+ str
+ )
+ return str
+
+conversions.append (((2, 5, 0),
+ conv,
+ ''))
+
+
+def conv (str):
+ str = re.sub (r'ly:import-module',
+ r'ly:module-copy', str)
+ return str
+
+conversions.append (((2, 5, 1),
+ conv,
+ 'ly:import-module -> ly:module-copy'))
+
+def conv (str):
+ str = re.sub (r'\\(column|fill-line|dir-column|center-align|right-align|left-align|bracketed-y-column)\s*<([^<]*)>',
+ r'\\\1 {\2}', str)
+ str = re.sub (r'\\(column|fill-line|dir-column|center-align|right-align|left-align|bracketed-y-column)\s*<([^<]*)>',
+ r'\\\1 {\2}', str)
+ str = re.sub (r'\\(column|fill-line|dir-column|center-align|right-align|left-align|bracketed-y-column)\s*<([^<]*)>',
+ r'\\\1 {\2}', str)
+ return str
+
+conversions.append (((2, 5, 2),
+ conv,
+ '\markup .. < .. > .. -> \markup .. { .. } ..'))
+
+def conv (str):
+ str = re.sub ('ly:find-glyph-by-name', 'ly:font-get-glyph', str)
+ str = re.sub ('"(scripts|clefs|accidentals)-', r'"\1.', str)
+ str = re.sub ("'hufnagel-do-fa", "'hufnagel.do.fa", str)
+ str = re.sub ("'(vaticana|hufnagel|medicaea|petrucci|neomensural|mensural)-", r"'\1.", str)
+ return str
+
+conversions.append (((2, 5, 3),
+ conv,
+ 'ly:find-glyph-by-name -> ly:font-get-glyph, remove - from glyphnames.'))
+
+
+
+def conv (str):
+ if re.search (r"\\encoding", str):
+ sys.stderr.write ("Sorry, input files should be UTF8.\n"
+ + "Please convert by hand.")
+ raise FatalConversionError()
+
+ return str
+
+conversions.append (((2, 5, 2),
+ conv,
+ 'ly:find-glyph-by-name -> ly:font-get-glyph, remove - from glyphnames.'))
+
+
################################
# END OF CONVERSIONS
################################