Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1)

Delta Between Two Patch Sets: python/convertrules.py

Issue 369930043: Change \partcombine (et al.) to \partCombine (Closed)
Left Patch Set: Revamped patch. Passes make & makedoc; adds \autoChange. Created 6 years, 3 months ago
Right Patch Set: Correct convert rules. Created 6 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « ly/property-init.ly ('k') | scm/define-context-properties.scm » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # (setq py-indent-offset 4) 2 # (setq py-indent-offset 4)
3 3
4 4
5 import string 5 import string
6 import re 6 import re
7 import sys 7 import sys
8 import lilylib 8 import lilylib
9 9
10 _ = lilylib._ 10 _ = lilylib._
(...skipping 3916 matching lines...) Expand 10 before | Expand all | Expand 10 after
3927 # because Grob.output-attributes.id = #(lambda ... ) will not work. 3927 # because Grob.output-attributes.id = #(lambda ... ) will not work.
3928 # Then for the rest we convert 'id' to 'output-attributes.id' 3928 # Then for the rest we convert 'id' to 'output-attributes.id'
3929 str = re.sub (manual_edits, r"\1output-attributes\2", str) 3929 str = re.sub (manual_edits, r"\1output-attributes\2", str)
3930 str = re.sub (automatic, r"\1output-attributes.id", str) 3930 str = re.sub (automatic, r"\1output-attributes.id", str)
3931 return str 3931 return str
3932 3932
3933 matchscmarg = (r'(?:[a-zA-Z_][-a-zA-Z_0-9]*|"(?:[^\\"]|\\.)*"|[-+]?[0-9.]+|\(' 3933 matchscmarg = (r'(?:[a-zA-Z_][-a-zA-Z_0-9]*|"(?:[^\\"]|\\.)*"|[-+]?[0-9.]+|\('
3934 + paren_matcher (10) + r"\))") 3934 + paren_matcher (10) + r"\))")
3935 3935
3936 @rule ((2, 21, 0), r"""\note #"4." -> \note {4.} 3936 @rule ((2, 21, 0), r"""\note #"4." -> \note {4.}
3937 \markup-command #" -> \markup-command " """) 3937 \markup-command #" -> \markup-command "
3938 \partcombine* -> \partCombine, \autochange -> \autoChange""")
3938 def conv (str): 3939 def conv (str):
3939 def repl1ly (m): 3940 def repl1ly (m):
3940 if m.group (2)[0] in "blm": 3941 if m.group (2)[0] in "blm":
3941 return m.group(1) + "{\\" + m.group(2) + "}" 3942 return m.group(1) + "{\\" + m.group(2) + "}"
3942 return m.group (1) + "{" + m.group (2) + "}" 3943 return m.group (1) + "{" + m.group (2) + "}"
3943 def repl1scm (m): 3944 def repl1scm (m):
3944 return ("%s(ly:make-duration %d %d)" % 3945 return ("%s(ly:make-duration %d %d)" %
3945 (m.group (1), 3946 (m.group (1),
3946 {"1": 0, "2": 1, "4": 2, "8": 3, "16": 4, 3947 {"1": 0, "2": 1, "4": 2, "8": 3, "16": 4,
3947 "32": 5, "64": 6, "128": 7, "256": 8, 3948 "32": 5, "64": 6, "128": 7, "256": 8,
(...skipping 15 matching lines...) Expand all
3963 str = re.sub (r"\(tuplet-number::(?:fraction-with-notes|non-default-fraction -with-notes|append-note-wrapper)\s" + 3964 str = re.sub (r"\(tuplet-number::(?:fraction-with-notes|non-default-fraction -with-notes|append-note-wrapper)\s" +
3964 paren_matcher (20) + r"\)", replscm, str) 3965 paren_matcher (20) + r"\)", replscm, str)
3965 str = re.sub (r'\(markup\s' + paren_matcher (20) + r'\)', 3966 str = re.sub (r'\(markup\s' + paren_matcher (20) + r'\)',
3966 replmarkup, str) 3967 replmarkup, str)
3967 str = re.sub (r'(\\(?:fret-diagram(?:-terse)?|harp-pedal|justify-string' 3968 str = re.sub (r'(\\(?:fret-diagram(?:-terse)?|harp-pedal|justify-string'
3968 r'|lookup|musicglyph|postscript|simple|tied-lyric|verbatim-fil e' 3969 r'|lookup|musicglyph|postscript|simple|tied-lyric|verbatim-fil e'
3969 r'|with-url|wordwrap-string' 3970 r'|with-url|wordwrap-string'
3970 r'|discant|freeBass|stdBass|stdBassIV|stdBassV|stdBassVI' 3971 r'|discant|freeBass|stdBass|stdBassIV|stdBassV|stdBassVI'
3971 r')\s*)[#$](\\?")', 3972 r')\s*)[#$](\\?")',
3972 r'\1\2', str) 3973 r'\1\2', str)
3973 return str 3974 str = re.sub (r"\\partcombine(Force|Up|Down|Chords|Apart|Unisono|SoloI|SoloI I|Automatic|)\b",
3974 3975 r"\\partCombine\1", str)
3975 @rule ((2, 21, 0), "syntax change \\partcombine -> \\partCombine")
3976 def conv(str):
3977 str = re.sub (r"\\partcombine", r"\\partCombine", str)
dak 2018/12/21 11:22:20 Uh, you realize that every line after this one is
3978 str = re.sub (r"\\partcombineForce", r"\\partCombineForce", str)
3979 str = re.sub (r"\\partcombineUp", r"\\partCombineUp", str)
3980 str = re.sub (r"\\partcombineDown", r"\\partCombineDown", str)
3981 str = re.sub (r"\\partcombineChords", r"\\partCombineChords", str)
3982 str = re.sub (r"\\partcombineApart", r"\\partCombineApart", str)
3983 str = re.sub (r"\\partcombineUnisono", r"\\partCombineUnisono", str)
3984 str = re.sub (r"\\partcombineSoloI", r"\\partCombineSoloI", str)
3985 str = re.sub (r"\\partcombineSoloII", r"\\partCombineSoloII", str)
3986 str = re.sub (r"\\partcombineAutomatic", r"\\partCombineAutomatic", str)
3987 return str
3988
3989 @rule ((2, 21, 0), "syntax change \\autochange -> \\autoChange")
3990 def conv(str):
3991 str = re.sub (r"\\autochange", r"\\autoChange", str) 3976 str = re.sub (r"\\autochange", r"\\autoChange", str)
3992 return str 3977 return str
3993 3978
3994 # Guidelines to write rules (please keep this at the end of this file) 3979 # Guidelines to write rules (please keep this at the end of this file)
3995 # 3980 #
3996 # - keep at most one rule per version; if several conversions should be done, 3981 # - keep at most one rule per version; if several conversions should be done,
3997 # concatenate them into a single "conv" function; 3982 # concatenate them into a single "conv" function;
3998 # 3983 #
3999 # - enclose strings to be localized with `_(' and `)'; 3984 # - enclose strings to be localized with `_(' and `)';
4000 # 3985 #
4001 # - write rule for bumping major stable version with 3986 # - write rule for bumping major stable version with
4002 # 3987 #
4003 # _ ("bump version for release") 3988 # _ ("bump version for release")
4004 # 3989 #
4005 # as exact description. 3990 # as exact description.
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b