summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kastrup <dak@gnu.org>2016-06-30 18:28:23 +0200
committerDavid Kastrup <dak@gnu.org>2016-07-10 19:39:10 +0200
commit685274d01ac3636cde82114a166ca952a7aa2f7c (patch)
treee3fb6309d9540a701fcaeb2bc6454d6bfccfa40d
parentbe3f2841c224e88d36ecf0f809be60893c83471d (diff)
Issue 4911/2: convert-ly rule to put \with before context mods
-rw-r--r--python/convertrules.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/python/convertrules.py b/python/convertrules.py
index 3e43a28133..dbe59faa96 100644
--- a/python/convertrules.py
+++ b/python/convertrules.py
@@ -3888,6 +3888,17 @@ def conv (str):
repl, str)
return str
+@rule ((2, 19, 46), r"\context ... \modification -> \context ... \with \modification")
+def conv (str):
+ word=r'(?:#?"[^"]*"|\b' + wordsyntax + r'\b)'
+ mods = string.join (re.findall ("\n(" + wordsyntax + r")\s*=\s*\\with(?:\s|\\|\{)", str)
+ + ['RemoveEmptyStaves','RemoveAllEmptyStaves'], "|")
+ str = re.sub (r"(\\(?:drums|figures|chords|lyrics|addlyrics|"
+ + r"(?:new|context)\s*" + word
+ + r"(?:\s*=\s*" + word + r")?)\s*)(\\(?:" + mods + "))",
+ r"\1\\with \2", str)
+ 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,