]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/convert-ly.py
*** empty log message ***
[lilypond.git] / scripts / convert-ly.py
index 4ca282ea992ef92e0669a6edb084369c67653a2a..1f0cea3ad7eeabf70f58de646e6248c766b537ad 100644 (file)
@@ -4,17 +4,9 @@
 #
 # 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__
@@ -1848,6 +1840,8 @@ Grob::preset_extent removed.
 
 
 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*',
@@ -2077,6 +2071,9 @@ conversions.append (((2, 3, 1), conv,
                     '''\\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',
@@ -2105,6 +2102,15 @@ conversions.append (((2, 3, 4), conv,
 
 
 
+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',
@@ -2127,6 +2133,8 @@ conversions.append (((2, 3, 9), conv,
 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,
@@ -2157,6 +2165,8 @@ def conv (str):
        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,
@@ -2206,7 +2216,16 @@ conversions.append (((2, 3, 18),
 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),
@@ -2225,8 +2244,18 @@ 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.'''))
+
 
-# nothing, just to make version numbers look good.
 def conv (str):
        return str
 
@@ -2234,6 +2263,67 @@ 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      
 ################################