str = re.sub ('ly:(system-start-text::print|note-head::brew-ez-stencil|ambitus::print)',
'\\1', str)
str = re.sub ('(\\bBeam\\s+#\')(?=thickness\\b)', '\\1beam-', str)
- str = re.sub (r'(\\context\s*\{{1}[^\}]+\\name\s+"*Dynamics"*[^\}]*\}{1})',
- '', str)
+ str = re.sub (r'(\\context\s*\{{1}[^\}]+\\type\s+\"?Engraver_group\"?\s+\\name\s+"*Dynamics"*[^\}]*\}{1})',
+ '% [Convert-ly] The Dynamics context is now included by default.', str)
return str
@rule ((2, 13, 10),
'(Note|Rest|Skip_event)_swallow_translator|String_number_engraver)"*',
'', str)
- str = re.sub (r"page-top-space\s*=\s*#([0-9.]+)",
- r"top-system-spacing #'space = #\1",
+ # match through the end of assignments in the form "x = 30", "x = 1 \in", or "x = #3"
+ str = re.sub (r"(page-top-space)\s*=\s*(([+-]?[.\d]*\s*\\[-\w]+)|(#?\s*[-+]?[.\d]+))",
+ r"obsolete-\g<0>"
+ r" top-system-spacing #'space = #(/ obsolete-\1 staff-space)",
str)
- str = re.sub (r"between-system-space\s*=\s*#([0-9.]+)",
- r"between-system-spacing #'space = #\1\nbetween-scores-system-spacing #'space = #\1",
+ str = re.sub (r"(between-system-space)\s*=\s*(([+-]?[.\d]*\s*\\[-\w]+)|(#?\s*[-+]?[.\d]+))",
+ r"obsolete-\g<0>"
+ r" between-system-spacing #'space = #(/ obsolete-\1 staff-space)"
+ r" between-scores-system-spacing #'space = #(/ obsolete-\1 staff-space)",
str)
- str = re.sub (r"between-system-padding\s*=\s*#([0-9.]+)",
- r"between-system-spacing #'padding = #\1\nbetween-scores-system-spacing #'padding = #\1",
+ str = re.sub (r"(between-system-padding)\s*=\s*(([+-]?[.\d]*\s*\\[-\w]+)|(#?\s*[-+]?[.\d]+))",
+ r"obsolete-\g<0>"
+ r" between-system-spacing #'padding = #(/ obsolete-\1 staff-space)"
+ r" between-scores-system-spacing #'padding = #(/ obsolete-\1 staff-space)",
str)
- str = re.sub (r"(after|between|before)-title-space\s*=\s*#([0-9.]+)",
- r"\1-title-spacing #'space = #\2",
+ str = re.sub (r"((before|between|after)-title-space)\s*=\s*(([+-]?[.\d]*\s*\\[-\w]+)|(#?\s*[-+]?[.\d]+))",
+ r"obsolete-\g<0>"
+ r" \2-title-spacing #'space = #(/ obsolete-\1 staff-space)",
str)
- if re.search(r'minimum-Y-extent', str):
+ if re.search(r"VerticalAxisGroup\s*#\s*'minimum-Y-extent", str):
stderr_write("\n")
- stderr_write(NOT_SMART % _("vertical spacing has been changed; minimum-Y-extent is obsolete.\n"))
+ stderr_write(NOT_SMART % _("minimum-Y-extent; vertical spacing no longer depends on the Y-extent of a VerticalAxisGroup.\n"))
stderr_write(UPDATE_MANUALLY)
return str
str = re.sub ('after-title-spacing', 'markup-system-spacing', str)
str = re.sub ('before-title-spacing', 'score-markup-spacing', str)
str = re.sub ('between-scores-system-spacing', 'score-system-spacing', str)
-
- # also converts page-breaking-between-system-spacing:
+ # this rule also converts page-breaking-between-system-spacing:
str = re.sub ('between-system-spacing', 'system-system-spacing', str)
-
str = re.sub ('between-title-spacing', 'markup-markup-spacing', str)
str = re.sub ('bottom-system-spacing', 'last-bottom-spacing', str)
str = re.sub ('top-title-spacing', 'top-markup-spacing', str)
str);
return str
+@rule ((2, 13, 39),
+ _ ("Rename vertical spacing grob properties."))
+def conv(str):
+ # this rule also converts default-next-staff-spacing:
+ str = re.sub ('next-staff-spacing', 'staff-staff-spacing', str)
+ # this is not a mistake:
+ # Both 'next- and 'between- become 'staff-staff-spacing.
+ # There is no conflict since they are in different grobs.
+ str = re.sub ('between-staff-spacing', 'staff-staff-spacing', str)
+ str = re.sub ('after-last-staff-spacing', 'staffgroup-staff-spacing', str)
+ str = re.sub ('inter-staff-spacing', 'nonstaff-relatedstaff-spacing', str)
+ str = re.sub ('non-affinity-spacing', 'nonstaff-unrelatedstaff-spacing', str)
+ str = re.sub ('inter-loose-line-spacing', 'nonstaff-nonstaff-spacing', str);
+
+ return str
+
+@rule ((2, 13, 40),
+ _ ("Remove \\paper variables head-separation and foot-separation."))
+def conv(str):
+ if re.search (r'head-separation', str):
+ stderr_write("\n")
+ stderr_write(NOT_SMART % ("head-separation.\n"))
+ stderr_write(_ ("Adjust settings for top-system-spacing instead.\n"))
+ stderr_write (UPDATE_MANUALLY)
+ if re.search (r'foot-separation', str):
+ stderr_write("\n")
+ stderr_write(NOT_SMART % ("foot-separation.\n"))
+ stderr_write(_ ("Adjust settings for last-bottom-spacing instead.\n"))
+ stderr_write(UPDATE_MANUALLY);
+
+ return str
+
+@rule ((2, 13, 42),
+ _ ("Rename space to basic-distance in various spacing alists.\n\
+Remove HarmonicParenthesesItem grob."))
+def conv(str):
+ str = re.sub (r'\(space\s+\.\s+([0-9]*\.?[0-9]*)\)', r'(basic-distance . \1)', str)
+ str = re.sub (r"#'space\s+=\s+#?([0-9]*\.?[0-9]*)", r"#'basic-distance = #\1", str)
+ if re.search (r'HarmonicParenthesesItem', str):
+ stderr_write ("\n")
+ stderr_write (NOT_SMART % ("HarmonicParenthesesItem.\n"))
+ stderr_write (_ ("HarmonicParenthesesItem has been eliminated.\n"))
+ stderr_write (_ ("Harmonic parentheses are part of the TabNoteHead grob.\n"))
+ stderr_write (UPDATE_MANUALLY);
+ return str
+
+@rule ((2, 13, 44),
+ _ ("Remove context from overrideTimeSignatureSettings and revertTimeSignatureSettings.\n"))
+
+def conv(str):
+ str = re.sub (r"\\(override|revert)TimeSignatureSettings(\s+[^#]*)(#[^#]*)#", r"\\\1TimeSignatureSettings\2#", str)
+ return str
+
+@rule ((2, 13, 46),
+ _ ("Change stringTunings from a list of semitones to a list of pitches.\n"\
+ "Change tenor and baritone ukulele names in string tunings.\n"\
+ "Generate messages for manual conversion of vertical spacing if required."))
+
+def conv(str):
+ def semitones2pitch(semitones):
+ steps = [0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6]
+ alterations = ["NATURAL", "SHARP", "NATURAL", "SHARP", "NATURAL", "NATURAL", "SHARP", "NATURAL", "SHARP", "NATURAL", "SHARP", "NATURAL"]
+ octave = 0
+ while semitones > 11:
+ octave += 1
+ semitones -=12
+ while semitones < 0:
+ octave -= 1
+ semitones += 12
+ pitchArgs = "%d %d %s" % (octave, steps[semitones], alterations[semitones])
+ return pitchArgs
+
+ def convert_tones (semitone_list):
+ tones = semitone_list.split ()
+ res = ""
+ for tone in tones:
+ args = semitones2pitch(int(tone))
+ res += ",(ly:make-pitch " + args + ") "
+ return res
+
+ def new_tunings (matchobj):
+ return "stringTunings = #`(" + convert_tones(matchobj.group(1)) + ")"
+ str = re.sub (r"stringTunings\s*=\s*#'\(([\d\s-]*)\)", \
+ new_tunings , str)
+
+ str = re.sub (r"ukulele-(tenor|baritone)-tuning", r"\1-ukulele-tuning", str)
+
+ if re.search (r"[^-]page-top-space", str):
+ stderr_write (NOT_SMART % "page-top-space. " + UPDATE_MANUALLY)
+ if re.search (r"[^-]between-system-(space|padding)", str):
+ stderr_write (NOT_SMART % "between-system-space, -padding. " + UPDATE_MANUALLY)
+ if re.search (r"[^-](before|between|after)-title-space", str):
+ stderr_write (NOT_SMART % "-title-space. " + UPDATE_MANUALLY)
+ if re.search (r"\\name\s", str):
+ stderr_write("\n" + _("Vertical spacing changes might affect user-defined contexts. ") + UPDATE_MANUALLY)
+
+ return str
+
+@rule ((2, 13, 48),
+ _ ("Replace bar-size with bar-extent."))
+
+def conv(str):
+ def size_as_extent (matchobj):
+ half = "%g" % (float (matchobj.group (1)) / 2)
+ return "bar-extent = #'(-" + half + " . " + half + ")"
+
+ str = re.sub (r"bar-size\s*=\s*#([0-9\.]+)", size_as_extent, str)
+
+ return str
+
+@rule ((2, 13, 51),
+ _ ("Woodwind diagrams: Changes to the clarinet diagram."))
+def conv(str):
+ if re.search(r'\\woodwind-diagram\s*#[^#]*clarinet\s', str):
+ stderr_write("\n")
+ stderr_write(NOT_SMART % _("woodwind-diagrams. Clarinet fingering changed to reflect actual anatomy of instrument.\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,