Reviewers: Neil Puttock, joeneeman,
Message:
I wrote a conversion, inspired by Neil, a month ago, but have been
unable to make the regex match the variety of expressions that could
have set the old-style variable,
while behaving correctly in the case of a single-line-commented-out
variable setting.
% between-staff-padding = 0.5 \cm
I need your opinions. I would happily fall back to a NOT_SMART "this
variable must now be expressed in units of staff spaces"
http://codereview.appspot.com/3793046/diff/1/python/convertrules.py
File python/convertrules.py (left):
http://codereview.appspot.com/3793046/diff/1/python/convertrules.py#oldcode2967
python/convertrules.py:2967: str = re.sub
(r"page-top-space\s*=\s*#([0-9.]+)",
The # in the match text skipped the form
page-top-space = 2\cm
any other reason for it?
http://codereview.appspot.com/3793046/diff/1/python/convertrules.py
File python/convertrules.py (right):
http://codereview.appspot.com/3793046/diff/1/python/convertrules.py#newcode2967
python/convertrules.py:2967: str = re.sub
(r"\n[^%]*(page-top-space)\s*=[^\n}]*",
Please comment on use of \n in search string, versus flag=MULTILINE. I
tested on Win and Linux, but not Mac.
Limitations: does not find
#(define page-top-space 3)
page-top-space \n = 3
http://codereview.appspot.com/3793046/diff/1/python/convertrules.py#newcode2968
python/convertrules.py:2968: r"\g<0> top-system-spacing #'space = #(/ \1
staff-space)",
The old variable assignment is retained, followed by
new_variable = #(/ old_variable staff-space)
Assumes there is a syntactically valid location for the new_variable
assignment after the newline.
http://codereview.appspot.com/3793046/diff/1/python/convertrules.py#newcode2984
python/convertrules.py:2984: stderr_write(NOT_SMART %
_("minimum-Y-extent; vertical spacing no longer depends on the Y-extent
of a VerticalAxisGroup.\n"))
Responding to discussion on issue 1298
http://codereview.appspot.com/3793046/diff/1/python/convertrules.py#newcode2991
python/convertrules.py:2991: str)
Responding to issue 1311
Description:
Several page spacing variables, formerly expressed in mm,
are now expressed in staff-spaces;
patch convert-ly to convert to the new units.
Correct text of a NOT_SMART
Create new [Convert-ly] comment with pointer to the
manual section on vertical spacing
Please review this at http://codereview.appspot.com/3793046/
Affected files:
M python/convertrules.py
Index: python/convertrules.py
diff --git a/python/convertrules.py b/python/convertrules.py
index
e17095c3884f4fea0c1c053a303c2bdc99f62bf1..87c01ff54b1a4384e505d5c9def2812b85b9b6b6
100644
--- a/python/convertrules.py
+++ b/python/convertrules.py
@@ -2964,24 +2964,32 @@ def conv(str):
'(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",
+ str = re.sub (r"\n[^%]*(page-top-space)\s*=[^\n}]*",
+ r"\g<0> top-system-spacing #'space = #(/ \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"\n[^%]*(between-system-space)\s*=[^\n}]*",
+ r"\g<0>\n between-system-spacing #'space = #(/ \1
staff-space)\n"
+ r" between-scores-system-spacing #'space = #(/ \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"\n[^%]*(between-system-padding)\s*=[^\n}]*",
+ r"\g<0>\n between-system-spacing #'padding = #(/ \1
staff-space)\n"
+ r" between-scores-system-spacing #'padding = #(/ \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"\n[^%]*?((before|between|
after)-title-space)\s*=[^\n}]*",
+ r"\g<0>\n \2-title-spacing #'space = #(/ \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)
+ str = re.sub (r"\\name\s",
+ r"% [Convert-ly] Spacing of user-defined contexts has
changed;\n"
+ r"% if you have too much space, see the section on
vertical spacing\n"
+ r"% in the Notation Reference regarding 'staff-affinity
= ##f.\n\g<0>",
+ str)
+
return str
@rule ((2, 13, 16),
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel