_ = lilylib._
-NOT_SMART = _ ("Not smart enough to convert %s")
-UPDATE_MANUALLY = _ ("Please refer to the manual for details, and update manually.")
+NOT_SMART = "\n" + _ ("Not smart enough to convert %s")
+UPDATE_MANUALLY = _ ("Please refer to the manual for details, and update manually.")
FROM_TO = _ ( "%s has been replaced by %s")
while match:
result = result + str[:match.end (1)] + " \markup"
str = str[match.end( 2):]
- # Count matching parentheses to find the end of the
+ # Count matching parentheses to find the end of the
# current markup:
nesting_level = 0
pars = re.finditer(r"[()]",str)
string_or_scheme = re.compile ('("(?:[^"\\\\]|\\\\.)*")|(#\\s*\'?\\s*\\()')
-# Only apply articulation_substitute () outside strings and
+# Only apply articulation_substitute () outside strings and
# Scheme expressions:
def smarter_articulation_subst (str):
result = ''
# Copy the string to output:
result = result + match.group (1)
str = str[match.end(1):]
- else: # Found a Scheme expression. Count
+ else: # Found a Scheme expression. Count
# matching parentheses to find its end
str = str[match.start ():]
nesting_level = 0
return str
-@rule ((1, 9, 3), (_ ("%s misspelling") % "\\acciaccatura") +
+@rule ((1, 9, 3), (_ ("%s misspelling") % "\\acciaccatura") +
", fingerHorizontalDirection -> fingeringOrientations")
def conv (str):
str = re.sub ('accacciatura',
str = re.sub ('soloADue', 'printPartCombineTexts', str)
str = re.sub (r'\\applymusic\s*#notes-to-clusters',
'\\makeClusters', str)
-
+
str = re.sub (r'pagenumber\s*=', 'firstpagenumber = ', str)
return str
str = re.sub (r'#\(paper-set-staff-size', '%Use set-global-staff-size at toplevel\n% #(layout-set-staff-size', str)
return str
-
+
@rule ((2, 3, 23), r'\context Foo = NOTENAME -> \context Foo = "NOTENAME"')
def conv (str):
stderr_write ('\n')
stderr_write (_ ('''
Auto beam settings must now specify each interesting moment in a measure
-explicitely; 1/4 is no longer multiplied to cover moments 1/2 and 3/4 too.
+explicitly; 1/4 is no longer multiplied to cover moments 1/2 and 3/4 too.
'''))
stderr_write (UPDATE_MANUALLY)
stderr_write ('\n')
@rule ((2, 7, 0), 'ly:get-default-font -> ly:grob-default-font')
def conv (str):
- return re.sub('ly:get-default-font', 'ly:grob-default-font', str)
+ return re.sub('ly:get-default-font', 'ly:grob-default-font', str)
@rule ((2, 7, 1), '''ly:parser-define -> ly:parser-define!
while dur > 1 :
dur /= 2
log2 += 1
-
+
den = (1 << dots) * (1 << log2)
num = ((1 << (dots+1)) - 1)
}
""" % (num*count, den)
-
+
str = re.sub (r'\\midi\s*{\s*\\tempo ([0-9]+)\s*([.]*)\s*=\s*([0-9]+)\s*}', sub_tempo, str)
return str
@rule ((2, 11, 6), _ ("Rename accidental glyphs, use glyph-name-alist."))
def conv (str):
-
+
def sub_acc_name (m):
idx = int (m.group (1).replace ('M','-'))
-
+
return ["accidentals.doublesharp",
"accidentals.sharp.slashslash.stemstemstem",
"accidentals.sharp",
"accidentals.flatflat"][4-idx]
str = re.sub (r"accidentals[.](M?[-0-9]+)",
- sub_acc_name, str)
+ sub_acc_name, str)
str = re.sub (r"(KeySignature|Accidental[A-Za-z]*)\s*#'style\s*=\s*#'([a-z]+)",
r"\1 #'glyph-name-alist = #alteration-\2-glyph-name-alist", str)
## FIXME: standard vs default, alteration-FOO vs FOO-alteration
return str
-@rule ((2, 11, 15), "TextSpanner #'edge-height -> #'bound-details #'right/left #'text = ...")
+@rule ((2, 11, 15), "TextSpanner #'edge-height -> #'bound-details #'right/left #'text = ...\n\
+Remove 'forced-distance for fixed spacing between staves in a PianoStaff.")
def conv (str):
def sub_edge_height (m):
s = ''
context = m.group (2)
if not context:
context = ''
-
+
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*[.]\s*)?TextSpanner\s*#'edge-height\s*=\s*#'\(\s*([0-9.-]+)\s+[.]\s+([0-9.-]+)\s*\)", sub_edge_height, str)
+ if re.search (r"#'forced-distance", str):
+ stderr_write (NOT_SMART % ("VerticalAlignment #'forced-distance.\n"))
+ stderr_write (_ ("Use the `alignment-offsets' sub-property of\n"))
+ stderr_write (_ ("NonMusicalPaperColumn #'line-break-system-details\n"))
+ stderr_write (_ ("to set fixed distances between staves.\n"))
return str
"\t(format-metronome-markup text dur count context)\n")
## warning 2/2: fret diagram properties moved to fret-diagram-details
- fret_props = ['barre-type',
- 'dot-color',
+ fret_props = ['barre-type',
+ 'dot-color',
'dot-radius',
'finger-code',
'fret-count',
\\sustainUp -> \\sustainOff, \\sustainDown -> \\sustainOn\n\
\\sostenutoDown -> \\sostenutoOn, \\sostenutoUp -> \\sostenutoOff")
def conv (str):
- str = re.sub (r"\\octave", r"\\octaveCheck", str)
+ str = re.sub (r"\\octave(?![a-zA-Z])", r"\\octaveCheck", str)
str = re.sub (r"arpeggioUp", r"arpeggioArrowUp", str)
str = re.sub (r"arpeggioDown", r"arpeggioArrowDown", str)
str = re.sub (r"arpeggioNeutral", r"arpeggioNormal", 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):
+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"))
ly:hairpin::after-line-breaking -> ly:spanner::kill-zero-spanned-time\n\
Dash parameters for slurs and ties are now in dash-definition"))
def conv(str):
- if re.search(r'\\bar\s*"."', 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)
stderr_write (UPDATE_MANUALLY)
return str
+@rule ((2, 13, 4),
+ _ ("Autobeaming rules have changed. override-auto-beam-setting and\n\
+revert-auto-beam-setting have been eliminated.\n\
+\\overrideBeamSettings has been added.\n\
+beatGrouping has been eliminated.\n\
+Different settings for vertical layout.\n\
+ly:system-start-text::print -> system-start-text::print\n\
+Beam #'thickness -> Beam #'beam-thickness\n\
+ly:note-head::brew-ez-stencil -> note-head::brew-ez-stencil\n\
+ly:ambitus::print -> ambitus::print\n\
+Explicit dynamics context definition from `Piano centered dynamics'\n\
+template replaced by new `Dynamics' context."))
+def conv(str):
+ if re.search("override-auto-beam-setting", str):
+ stderr_write ("\n")
+ stderr_write (NOT_SMART % _("override-auto-beam-setting.\n\
+ Autobeam settings are now overriden with \\overrideBeamSettings.\n"))
+ stderr_write (UPDATE_MANUALLY)
+ if re.search("revert-auto-beam-setting", str):
+ stderr_write ("\n")
+ stderr_write (NOT_SMART % _("override-auto-beam-setting.\n\
+ Autobeam settings are now reverted with \\revertBeamSettings.\n"))
+ stderr_write (UPDATE_MANUALLY)
+ str = re.sub(r"\\set\s+beatGrouping", r"\\setBeatGrouping", str)
+ if re.search(r"\w+\s*.\s*beatGrouping", str):
+ stderr_write (NOT_SMART % _("beatGrouping. \n\
+ beatGrouping with a specified context must now be accomplished with\n\
+ \\overrideBeamSettings.\n"))
+ stderr_write (UPDATE_MANUALLY)
+ if re.search(r'alignment-offsets', str):
+ stderr_write("\n")
+ stderr_write(NOT_SMART % _("alignment-offsets has been changed to alignment-distances: \
+you must now specify the distances between staves rather than the offset of staves.\n"))
+ stderr_write(UPDATE_MANUALLY)
+ 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}[^\}]+\\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),
+ _ ("Remove obsolete engravers/translators: Note_swallow_translator,\n\
+Rest_swallow_translator, Skip_event_swallow_translator, Swallow_engraver,\n\
+Swallow_performer and String_number_engraver.\n\
+New vertical spacing variables."))
+def conv(str):
+ str = re.sub (r'\\(consists|remove)\s+"*(Swallow_(engraver|performer)|'
+ '(Note|Rest|Skip_event)_swallow_translator|String_number_engraver)"*',
+ '', str)
+
+ # 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*(([+-]?[.\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*(([+-]?[.\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"((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"VerticalAxisGroup\s*#\s*'minimum-Y-extent", str):
+ stderr_write("\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
+
+@rule ((2, 13, 16),
+ _ ("Unify fetaNumber and fetaDynamic encodings"))
+def conv(str):
+ return re.sub(r'\bfeta(Number|Dynamic)', 'fetaText', str)
+
+@rule ((2, 13, 18),
+ _ ("\\RemoveEmpty*StaffContext -> \\*Staff \\RemoveEmptyStaves"))
+def conv(str):
+ str = re.sub (r"\\RemoveEmpty(|Drum|Rhythmic|Tab)StaffContext",
+ r"\\\1Staff \\RemoveEmptyStaves",
+ str);
+ str = re.sub (r"\\AncientRemoveEmptyStaffContext",
+ r"\\VaticanaStaff \\RemoveEmptyStaves",
+ str);
+ return str
+
+@rule ((2, 13, 20),
+ _ ("\\cresc etc. are now postfix operators"))
+def conv (str):
+ str = re.sub (r'\\(cresc|dim|endcresc|enddim)\b', r'\\deprecated\1', str)
+ return str
+
+@rule ((2, 13, 29),
+ _ ("Eliminate beamSettings, beatLength, \\setBeatGrouping, \\overrideBeamSettings and \\revertBeamSettings.\n\
+\"accordion.accEtcbase\" -> \"accordion.etcbass\""))
+def conv(str):
+ def sub_acc (m):
+ d = {
+ 'Dot': 'dot',
+ 'Discant': 'discant',
+ 'Bayanbase': 'bayanbass',
+ 'Stdbase': 'stdbass',
+ 'Freebase': 'freebass',
+ 'OldEE': 'oldEE'
+ }
+ return '"accordion.%s"' % d[m.group (1)]
+
+ str = re.sub (r'"accordion\.acc([a-zA-Z]+)"',
+ sub_acc, str)
+ if re.search(r'overrideBeamSettings', str):
+ stderr_write("\n")
+ stderr_write(NOT_SMART % _("\\overrideBeamSettings. Use \\set beamExceptions or \\overrideTimeSignatureSettings.\n"))
+ stderr_write(UPDATE_MANUALLY)
+ if re.search(r'revertBeamSettings', str):
+ stderr_write("\n")
+ stderr_write(NOT_SMART % _("\\revertBeamSettings. Use \\set beamExceptions or \\revertTimeSignatureSettings.\n"))
+ stderr_write(UPDATE_MANUALLY)
+ if re.search(r'beamSettings', str):
+ stderr_write("\n")
+ stderr_write(NOT_SMART % _("beamSettings. Use baseMoment, beatStructure, and beamExceptions.\n"))
+ stderr_write(UPDATE_MANUALLY)
+ if re.search(r'beatLength', str):
+ stderr_write("\n")
+ stderr_write(NOT_SMART % _("beatLength. Use baseMoment and beatStructure.\n"))
+ stderr_write(UPDATE_MANUALLY)
+ if re.search(r'setBeatGrouping', str):
+ stderr_write("\n")
+ stderr_write(NOT_SMART % _("setbeatGrouping. Use baseMoment and beatStructure.\n"))
+ stderr_write(UPDATE_MANUALLY)
+ return str
+
+@rule ((2, 13, 31),
+ _ ("Woodwind diagrams: Move size, thickness, and graphic from argument list to properties.\n\
+Deprecate negative dash-period for hidden lines: use #'style = #'none instead."))
+def conv(str):
+ if re.search(r'woodwind-diagram', str):
+ stderr_write("\n")
+ stderr_write(NOT_SMART % _("woodwind-diagrams. Move size, thickness, and graphic to properties. Argument should be just the key list.\n"))
+ stderr_write(UPDATE_MANUALLY)
+ str = re.sub (r"dash-period\s+=\s*#\s*-[0-9.]+",
+ r"style = #'none",
+ str);
+ return str
+
+@rule ((2, 13, 36),
+ _ ("Rename vertical spacing variables.\n\
+Add fretboard-table argument to savePredefinedFretboard."))
+def conv(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)
+ # 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 = re.sub (r"storePredefinedDiagram",
+ r"storePredefinedDiagram #default-fret-table",
+ 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,
# - write rule for bumping major stable version with
#
# _ ("bump version for release")
-#
+#
# as exact description.