]> git.donarmstrong.com Git - lilypond.git/blobdiff - python/convertrules.py
Issue 4384: Remove convert-ly rule \shiftOff -> \undo\shiftOn
[lilypond.git] / python / convertrules.py
index d00a411c6eb7d2b97bb8d54213f2eaccb912a619..8dc8e9160ab887078c30a01bba3b9916df74f682 100644 (file)
@@ -2846,7 +2846,7 @@ def conv(str):
     if re.search("(Slur|Tie)\w+#\'dash-fraction", str) \
         or re.search("(Slur|Tie)\w+#\'dash-period", str):
         stderr_write (NOT_SMART % "dash-fraction, dash-period")
-        stderr_write (_ ("Dash parameters for slurs and ties are now in \'dash-details.\n"))
+        stderr_write (_ ("Dash parameters for slurs and ties are now in \'dash-definition.\n"))
         stderr_write (UPDATE_MANUALLY)
     return str
 
@@ -3450,7 +3450,7 @@ def conv (str):
         if m.group (1):
             return m.group (0)
         x = m.group (2) + m.group (4)
-        
+
         if m.group (3):
             x = x + re.sub (r"(\s*)(" + symbol_list + ")", fn_path_replace,
                             m.group (3))
@@ -3667,7 +3667,7 @@ def conv(str):
 def conv(str):
     str = re.sub (r"\\stringTuning\s*\\notemode(\s*)@?\{\s*(.*?)\s*@?}",
                   r"\\stringTuning\1\2", str)
-    if re.search (r'\bstaff-padding\b', str):
+    if re.search (r'[^-\w]staff-padding[^-\w]', str):
         stderr_write (NOT_SMART % "staff-padding")
         stderr_write (_ ("Staff-padding now controls the distance to the baseline, not the nearest point."))
     return str
@@ -3683,38 +3683,64 @@ def conv(str):
     str = re.sub ("New_dynamic_engraver", "Dynamic_engraver", str)
     return str
 
-@rule((2, 17, 30), r'''\override/\tweak transparent -> \hide
-\override/\tweak stencil -> \omit''')
+@rule ((2, 17, 97), r'''(make-relative (a b) b ...) -> make-relative (a b) #{ a b #}...''')
+def conv (str):
+    str = re.sub (r"(\(make-relative\s+\(\s*(([A-Za-z][-_A-Za-z0-9]*)" +
+                  r"(?:\s+[A-Za-z][-_A-Za-z0-9]*)*)\s*\)\s*)\3(?=\s)",
+                  r"\1(make-event-chord (list \2))", str)
+    str = re.sub (r"(\(make-relative\s+\(\s*([A-Za-z][-_A-Za-z0-9]*" +
+                  r"(?:\s+([A-Za-z][-_A-Za-z0-9]*))+)\s*\)\s*)\3(?=\s)",
+                  r"\1(make-sequential-music (list \2))", str)
+    return str
+
+@rule ((2, 18, 0),
+       _ ("bump version for release"))
+def conv (str):
+    return str
+
+@rule ((2, 19, 2), r"\lyricsto \new/\context/... -> \new/\context/... \lyricsto")
+def conv (str):
+    word=r'(?:#?"[^"]*"|\b' + wordsyntax + r'\b)'
+    str = re.sub (r"(\\lyricsto\s*" + word + r"\s*)(\\(?:new|context)\s*" + word
+                  + r"(?:\s*=\s*" + word + r")?\s*)",
+                  r"\2\1", str)
+    str = re.sub (r"(\\lyricsto\s*" + word + r"\s*)\\lyricmode\b\s*",
+                  r"\1", str)
+    str = re.sub (r"(\\lyricsto\s*" + word + r"\s*)\\lyrics\b\s*",
+                  r"\\new Lyrics \1", str)
+    str = re.sub (r'\\lyricmode\s*(\\lyricsto\b)', r"\1", str)
+    return str
+
+@rule ((2, 19, 7), "keySignature -> keyAlterations")
 def conv(str):
-# Only use \undo \hide for properties that also use \hide in the same
-# file.  The same is later done for \undo \omit.
-    matches = {}
-    def subst(m):
-        matches [m.group (2)]=True
-        return r"\hide" + m.group (1)
-    str = re.sub (r"\\override(\s*([A-Za-z.]*))\.transparent\s*=\s*##t",
-                  subst, str)
-    def subst(m):
-        if m.group (2) in matches:
-            return r"\undo \hide" + m.group (1)
-        return m.group ()        
-    str = re.sub (r"\\revert(\s*([A-Za-z.]*))\.transparent",
-                  subst, str)
-    matches = {}
-    def subst(m):
-        matches [m.group (2)]=True
-        return r"\omit" + m.group (1)
-    str = re.sub (r"\\override(\s*([A-Za-z.]*))\.stencil\s*=\s*##f",
-                  subst, str)
-    def subst(m):
-        if m.group (2) in matches:
-            return r"\undo \omit" + m.group (1)
-        return m.group ()        
-    str = re.sub (r"\\revert(\s*([A-Za-z.]*))\.stencil",
-                  subst, str)
+    str = re.sub (r'\bkeySignature\b', 'keyAlterations', str)
+    str = re.sub (r'\blastKeySignature\b', 'lastKeyAlterations', str)
+    str = re.sub (r'\blocalKeySignature\b', 'localAlterations', str)
+    return str
+
+@rule ((2, 19, 11), "thin-kern -> segno-kern")
+def conv(str):
+    str = re.sub (r'\bthin-kern\b', 'segno-kern', str)
+    return str
+
+# before_id is written in a manner where it will only substantially
+# (rather than as a lookbefore assertion) match material that could
+# not be part of a previous id.  In that manner, one replacement does
+# not inhibit an immediately adjacent replacement.
+
+before_id = r'(?:^|(?<!\\)(?:\\\\)+|(?<=[^-_\\a-zA-Z])|(?<=[^a-zA-Z][-_]))'
 
-    str = re.sub (r"\\tweak(\s+|\s*#')transparent\s*##t",r"\\hide", str)
-    str = re.sub (r"\\tweak(\s+|\s*#')stencil\s*##f",r"\\omit", str)
+# after_id is a pure lookbehind assertion so its match string is
+# always empty
+
+after_id = r'(?![a-zA-Z]|[-_][a-zA-Z])'
+
+@rule ((2, 19, 16), """implicitTimeSignatureVisibility -> initialTimeSignatureVisibility
+csharp -> c-sharp""")
+def conv(str):
+    str = re.sub (r'\bimplicitTimeSignatureVisibility\b', 'initialTimeSignatureVisibility', str)
+    str = re.sub ('(' + before_id + r'[a-g])((?:sharp){1,2}|(?:flat){1,2})'
+                  + after_id, r'\1-\2', str)
     return str
 
 # Guidelines to write rules (please keep this at the end of this file)