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',
return '(ly:make-pitch %s %s %s)' % (m.group(1), m.group (2),
alt)
- def fixKS(m):
- words = { '-2': "DOUBLE-FLAT",
- '-1': "FLAT",
- '0': "NATURAL",
- '1': "SHARP",
- '2': "DOUBLE-SHARP"}
- parts = m.group().split("`")
- if len(parts) != 2:
- return m.group()
- numbers = re.findall(r'-?\d+',parts[1])
- if len(numbers) % 3 != 0:
- return m.group()
- newalterations = []
- for i in range(len(numbers) / 3):
- newalterations.append('(('+numbers[i*3]+' . '+numbers[i*3+1]+') . ,'+
- words[numbers[i*3+2]]+')')
- whitespace = '\n'+' '*(len(parts[0])+2)
- output = parts[0]+'`('+whitespace.join(newalterations)+')'
- return output
-
str =re.sub ("\\(ly:make-pitch *([0-9-]+) *([0-9-]+) *([0-9-]+) *\\)",
sub_alteration, str)
as a substitution text.""") % (m.group (1), m.group (2)) )
raise FatalConversionError ()
- if re.search ("ly:(make-pitch|pitch-alteration)", str):
+ if re.search ("ly:(make-pitch|pitch-alteration)", str) \
+ or re.search ("keySignature", str):
stderr_write ('\n')
stderr_write (NOT_SMART % "pitches")
stderr_write ('\n')
stderr_write (
_ ("""The alteration field of Scheme pitches was multiplied by 2
-to support quarter tone accidentals. You must update the following construct
-manually: calls of ly:make-pitch and ly:pitch-alteration
+to support quarter tone accidentals. You must update the following constructs manually:
+
+* calls of ly:make-pitch and ly:pitch-alteration
+* keySignature settings made with \property
"""))
raise FatalConversionError ()
-
- findKeySig = re.compile(r'\\property\s+\w+\.keySignature .*?\)\s*\)',re.DOTALL)
- str = findKeySig.sub(fixKS,str)
return str
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
str = str.replace ('alteration-default-glyph-name-alist',
'standard-alteration-glyph-name-alist')
-
- def fixKS(m):
- words = { '-4': "DOUBLE-FLAT",
- '-3': "THREE-Q-FLAT",
- '-2': "FLAT",
- '-1': "SEMI-FLAT",
- '0': "NATURAL",
- '1': "SEMI-SHARP",
- '2': "SHARP",
- '3': "THREE-Q-SHARP",
- '4': "DOUBLE-SHARP"}
- parts = m.group().split("`")
- if len(parts) != 2:
- return m.group()
- numbers = re.findall(r'-?\d+',parts[1])
- if len(numbers) % 3 != 0:
- return m.group()
- newalterations = []
- for i in range(len(numbers) / 3):
- newalterations.append('(('+numbers[i*3]+' . '+numbers[i*3+1]+') . ,'+
- words[numbers[i*3+2]]+')')
- whitespace = '\n'+' '*(len(parts[0])+2)
- output = parts[0]+'`('+whitespace.join(newalterations)+')'
- return output
-
- findKeySig = re.compile(r'\\set\s+\w+\.keySignature .*?\)\s*\)',re.DOTALL)
- str = findKeySig.sub(fixKS,str)
-
return str
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)
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',
@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"))
@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\s+\w+\.keySignature',str):
+ if re.search(r'\set Staff.keySignature', str):
stderr_write ("\n")
- stderr_write (NOT_SMART % _("Staff.keySignature - the alist is no \
+ 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
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. \\overrideBeamSettings has been\n\
+added. BeatGrouping has been eliminated.\n\
+Different settings for vertical layout."))
+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+\.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)
+ 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.