X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=python%2Fconvertrules.py;h=72479a952f27d98de986e7ab573aaf87d40630c8;hb=5a2114f2d332c715579cc3c236fcb4ecfba5c3b1;hp=12a3b6c5b64655ea8d76e9d08fd534f96e512aa2;hpb=341abefdd6d296f35839a57101266dfb150d1ec0;p=lilypond.git diff --git a/python/convertrules.py b/python/convertrules.py index 12a3b6c5b6..72479a952f 100644 --- a/python/convertrules.py +++ b/python/convertrules.py @@ -374,7 +374,7 @@ def conv (str): return str -# TODO: lots of other syntax change should be done here as well +# TODO: lots of other syntax changes should be done here as well @rule ((1, 3, 92), 'basicXXXProperties -> XXX, Repeat_engraver -> Volta_engraver') def conv (str): str = re.sub ('basicCollisionProperties', 'NoteCollision', str) @@ -418,7 +418,7 @@ def conv (str): str = re.sub ('\\\\voicefour', '\\\\voiceFour', str) # I don't know exactly when these happened... - # ugh, we loose context setting here... + # ugh, we lose context setting here... str = re.sub ('\\\\property *[^ ]*verticalDirection[^=]*= *#?"?(1|(\\\\up))"?', '\\\\stemUp\\\\slurUp\\\\tieUp', str) str = re.sub ('\\\\property *[^ ]*verticalDirection[^=]*= *#?"?((-1)|(\\\\down))"?', '\\\\stemDown\\\\slurDown\\\\tieDown', str) str = re.sub ('\\\\property *[^ ]*verticalDirection[^=]*= *#?"?(0|(\\\\center))"?', '\\\\stemBoth\\\\slurBoth\\\\tieBoth', str) @@ -431,7 +431,7 @@ def conv (str): str = re.sub ('\\\\property *[^ .]*[.]?([a-z]+)VerticalDirection[^=]*= *#?"?((-1)|(\\\\down))"?', '\\\\\\1Down', str) str = re.sub ('\\\\property *[^ .]*[.]?([a-z]+)VerticalDirection[^=]*= *#?"?(0|(\\\\center))"?', '\\\\\\1Both', str) - # (lacks capitalisation slur -> Slur) + # (lacks capitalization slur -> Slur) str = re.sub ('([a-z]+)VerticalDirection[^=]*= *#?"?(1|(\\\\up))"?', '\\1 \\\\override #\'direction = #1', str) str = re.sub ('([a-z]+)VerticalDirection[^=]*= *#?"?((-1)|(\\\\down))"?', '\\1 \\override #\'direction = #-1', str) str = re.sub ('([a-z]+)VerticalDirection[^=]*= *#?"?(0|(\\\\center))"?', '\\1 \\\\override #\'direction = #0', str) @@ -1821,7 +1821,6 @@ def conv (str): a = g - lower_pitches [-1] - print s , lower_pitches, g, a, s str = 'cdefgab' [s] str += ['eses', 'es', '', 'is', 'isis'][a + 2] if o < 0: @@ -2574,6 +2573,12 @@ def conv (str): return re.sub ('ly:clone-parser', 'ly:parser-clone', str) +@rule ((2, 11, 3), "no-spacing-rods -> extra-spacing-width") +def conv (str): + str = re.sub (r"no-spacing-rods\s+=\s+##t", r"extra-spacing-width = #'(+inf.0 . -inf.0)", str) + str = re.sub (r"no-spacing-rods\s+=\s+##f", r"extra-spacing-width = #'(0 . 0)", str) + return str + @rule ((2, 11, 5), _ ("deprecate cautionary-style. Use AccidentalCautionary properties")) def conv (str): @@ -2650,7 +2655,7 @@ def conv (str): return str -@rule ((2, 11, 15), "#'edge-height -> #'bound-details #'right/left #'text = ...") +@rule ((2, 11, 15), "TextSpanner #'edge-height -> #'bound-details #'right/left #'text = ...") def conv (str): def sub_edge_height (m): s = '' @@ -2658,20 +2663,22 @@ def conv (str): ('right', m.group (4))]: if h and float (h): - once = m.group(1) + once = m.group (1) if not once: once = '' + context = m.group (2) + if not context: + context = '' - s += (r"%s \override %s #'bound-details #'%s #'text = \markup { \draw-line #'(0 . %s) }" - % (once, m.group (2), var, h)) + s += (r"%s \override %sTextSpanner #'bound-details #'%s #'text = \markup { \draw-line #'(0 . %s) }" + % (once, context, var, h)) s += '\n' return s - str = re.sub (r"(\\once)?\s*\\override\s*([a-zA-Z.]+)\s*#'edge-height\s*=\s*#'\(([0-9.-]+)\s+[.]\s+([0-9.-]+)\)", - sub_edge_height, str) + str = re.sub (r"(\\once)?\s*\\override\s*([a-zA-Z]+\s*[.]\s*)?TextSpanner\s*#'edge-height\s*=\s*#'\(\s*([0-9.-]+)\s+[.]\s+([0-9.-]+)\s*\)", sub_edge_height, str) return str @@ -2791,6 +2798,107 @@ def conv (str): str = re.sub (r"infinite-spacing-height\s+=\s+##f", r"extra-spacing-height = #'(0 . 0)", str) return str +@rule ((2, 11, 55), "#(set-octavation oct) -> \\ottava #oct,\n\ +\\put-adjacent markup axis dir markup -> \\put-adjacent axis dir markup markup") +def conv (str): + str = re.sub (r"#\(set-octavation (-*[0-9]+)\)", r"\\ottava #\1", str) + if re.search ('put-adjacent', str): + stderr_write (NOT_SMART % _ ("\\put-adjacent argument order.\n")) + stderr_write (_ ("Axis and direction now come before markups:\n")) + stderr_write (_ ("\\put-adjacent axis dir markup markup.")) + return str + +@rule ((2, 11, 57), "\\center-align -> \\center-column, \\hcenter -> \\center-align") +def conv (str): + str = re.sub (r"([\\:]+)center-align", r"\1center-column", str) + str = re.sub (r"hcenter(\s+)", r"center-align\1", str) + return str + +@rule ((2, 11, 60), "printallheaders -> print-all-headers") +def conv (str): + str = re.sub (r"printallheaders", r"print-all-headers", str) + return str + +@rule ((2, 11, 61), "gregorian-init.ly -> gregorian.ly") +def conv (str): + str = re.sub (r'\\include(\s+)"gregorian-init.ly"', r'\\include\1"gregorian.ly"', str) + return str + +@rule ((2, 11, 62), "makam-init.ly -> makam.ly, \\bigger -> \\larger") +def conv (str): + str = re.sub (r'\\include(\s+)"makam-init.ly"', r'\\include\1"makam.ly"', str) + str = re.sub (r"([\\:])bigger", r"\1larger", str) + return str + +@rule ((2, 11, 64), "systemSeparatorMarkup -> system-separator-markup,\n\ +InnerStaffGroup -> StaffGroup, InnerChoirStaff -> ChoirStaff") +def conv (str): + str = re.sub (r'systemSeparatorMarkup', r'system-separator-markup', str) + if re.search (r'\\InnerStaffGroup', str): + stderr_write ("\n") + stderr_write (NOT_SMART % _("re-definition of InnerStaffGroup.\n")) + stderr_write (FROM_TO % ("InnerStaffGroup", "StaffGroup.\n")) + stderr_write (UPDATE_MANUALLY) + raise FatalConversionError () + if re.search (r'\\InnerChoirStaff', str): + stderr_write ("\n") + stderr_write (NOT_SMART % _("re-definition of InnerChoirStaff.\n")) + stderr_write (FROM_TO % ("InnerChoirStaff", "ChoirStaff.\n")) + stderr_write (UPDATE_MANUALLY) + raise FatalConversionError () + else: + str = re.sub ('InnerStaffGroup', 'StaffGroup', str) + str = re.sub ('InnerChoirStaff', 'ChoirStaff', str) + return str + +@rule ((2, 12, 0), + _ ("Syntax changes for \\addChordShape and \\chord-shape") + "\n" + \ + _ ("bump version for release")) +def conv(str): + if re.search(r'\\addChordShape', str): + stderr_write ("\n") + stderr_write (NOT_SMART % _("stringTuning must be added to \ +addChordShape call.\n")) + stderr_write (UPDATE_MANUALLY) + raise FatalConversionError () + if re.search (r'\\chord-shape', str): + stderr_write ("\n") + stderr_write (NOT_SMART % _("stringTuning must be added to \ +chord-shape call.\n")) + stderr_write (UPDATE_MANUALLY) + raise FatalConversionError () + return str + +@rule ((2,12,3), + _ ("Remove oldaddlyrics")) +def conv(str): + if re.search(r'\\oldaddlyrics', str): + stderr_write ("\n") + stderr_write (NOT_SMART % _("oldaddlyrics is no longer supported. \n \ + Use addlyrics or lyrsicsto instead.\n")) + stderr_write (UPDATE_MANUALLY) + raise FatalConversionError () + return str + +@rule ((2, 13, 0), _ ("keySignature property not reversed any more\n\ +MIDI 47: orchestral strings -> orchestral harp")) +def conv(str): + if re.search(r'\set Staff.keySignature', str): + stderr_write ("\n") + stderr_write (NOT_SMART % _("The alist for Staff.keySignature is no \ +longer in reversed order.\n")) + str = str.replace('"orchestral strings"', '"orchestral harp"') + return str + +@rule ((2, 13, 1), + _ ("\\bar \".\" now produces a thick barline")) +def conv(str): + if re.search(r'\\bar\s*"."', str): + stderr_write ("\n") + stderr_write (NOT_SMART % _("\\bar \".\" now produces a thick barline.\n")) + stderr_write (UPDATE_MANUALLY) + return str + # Guidelines to write rules (please keep this at the end of this file) # # - keep at most one rule per version; if several conversions should be done,