]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/convert-ly.py
2003 -> 2004
[lilypond.git] / scripts / convert-ly.py
index c2908d0698e5a418eee451a08de8943b1f49444b..fd8aa4e5c4f895d68c29a5c1b154470d99f0a2cb 100644 (file)
@@ -4,7 +4,7 @@
 #
 # source file of the GNU LilyPond music typesetter
 #
-# (c)  1998--2003  Han-Wen Nienhuys <hanwen@cs.uu.nl>
+# (c) 1998--2004  Han-Wen Nienhuys <hanwen@cs.uu.nl>
 #                 Jan Nieuwenhuizen <janneke@gnu.org>
 
 
@@ -1762,6 +1762,7 @@ def conv (str):
 
 conversions.append (((2,1,17), conv, """\\partcombine syntax change to \\newpartcombine"""))
 
+
 def conv (str):
        str = re.sub (r'\\newpartcombine', r'\\partcombine', str)
        str = re.sub (r'\\autochange\s+Staff', r'\\autochange ', str)
@@ -1771,6 +1772,49 @@ conversions.append (((2,1,18), conv, """\\newpartcombine -> \\partcombine,
 \\autochange Staff -> \\autochange
 """))
 
+
+
+
+def conv (str):
+       str = re.sub (r'\\include "drumpitch-init.ly"','', str)
+       str = re.sub (r'\\pitchnames ','pitchnames = ', str)
+       str = re.sub (r'\\chordmodifiers ','chordmodifiers = ', str)
+       str = re.sub (r'\bdrums\b\s*=','drumContents = ', str)
+       str = re.sub (r'\\drums\b','\\drumContents ', str)
+       
+
+       if re.search ('drums->paper', str):
+               sys.stderr.write ("\nDrum notation found. Check file manually!")
+               
+       str = re.sub (r"""\\apply\s+#\(drums->paper\s+'([a-z]+)\)""",
+                     r"""\property DrumStaff.drumStyleTable = #\1-style""",
+                     str)
+
+       if re.search ('Thread', str):
+               sys.stderr.write ("\nThread found. Check file manually!\n");
+
+       str = re.sub (r"""(\\once\s*)?\\property\s+Thread\s*\.\s*NoteHead\s*"""
+                     + r"""\\(set|override)\s*#'style\s*=\s*#'harmonic"""
+                     + r"""\s+([a-z]+[,'=]*)([0-9]*\.*)"""                   
+                     ,r"""<\3\\harmonic>\4""", str)
+
+       str = re.sub (r"""\\new Thread""", """\context Voice""", str)
+       str = re.sub (r"""Thread""", """Voice""", str)
+
+       if re.search ('\bLyrics\b', str):
+               sys.stderr.write ("\nLyrics found. Check file manually!\n");
+
+       str = re.sub (r"""LyricsVoice""", r"""L@ricsVoice""", str)
+       str = re.sub (r"""\bLyrics\b""", r"""LyricsVoice""", str)
+       str = re.sub (r"""LyricsContext""", r"""LyricsVoiceContext""", str)
+       str = re.sub (r"""L@ricsVoice""", r"""LyricsVoice""",str)
+       
+       
+       return str
+
+conversions.append (((2,1,19), conv, """Drum notation changes, Removing \chordmodifiers, \notenames.
+Harmonic notes. Thread context removed. Lyrics context removed."""))
+
 ################################
 #      END OF CONVERSIONS      
 ################################