]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/convert-ly.py
*** empty log message ***
[lilypond.git] / scripts / convert-ly.py
index 82a039460960b9382f953d76878e5349761b541d..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*',
@@ -2250,6 +2244,17 @@ 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
@@ -2292,13 +2297,32 @@ def conv (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'))
+                    'ly:find-glyph-by-name -> ly:font-get-glyph, remove - from glyphnames.'))
+
 
 ################################
 #      END OF CONVERSIONS