From: Werner Lemberg Date: Mon, 25 Oct 2004 20:46:09 +0000 (+0000) Subject: * scripts/lilypond-book.py (snippet_res): Fix regexps and make them ignore X-Git-Tag: release/2.3.25~13 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=463e568eb99e6573f695f6c6cbac7d4dad56610f;p=lilypond.git * scripts/lilypond-book.py (snippet_res): Fix regexps and make them ignore whitespace properly. (compose_ly): Use `re.split' instead of `string.split' to remove surrounding whitespace. --- diff --git a/ChangeLog b/ChangeLog index 8671d43f2d..5dbb46b742 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ * scripts/lilypond-book.py: s/option-sep/option_sep/. (format_res) [LATEX, TEXINFO]: Skip whitespace before comma also. + (snippet_res): Fix regexps and make them ignore whitespace properly. + (compose_ly): Use `re.split' instead of `string.split' to remove + surrounding whitespace. Some formatting to get more consistency. 2004-10-25 Han-Wen Nienhuys diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index cc1b8e98d3..ace30b4cf5 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -157,7 +157,7 @@ snippet_res = { r'''(?mx) (?P [^:]*):) + (\s*(?P.*?)\s*:)?\s* (?P.*?) />)''', @@ -165,7 +165,7 @@ snippet_res = { r'''(?msx) (?P [^>]+)? + \s*(?P.*?)\s* > (?P.*?) )''', @@ -174,9 +174,9 @@ snippet_res = { r'''(?mx) (?P [^>]+)? - >\s* - (?P[^<]+)\s* + \s*(?P.*?)\s* + > + \s*(?P.*?)\s* )''', 'multiline_comment': @@ -211,24 +211,24 @@ snippet_res = { (?P\S+?) })''', - 'lilypond': + 'lilypond': r'''(?smx) ^[^%\n]*? (?P \\lilypond\s*( \[ - (?P.*?) + \s*(?P.*?)\s* \])?\s*{ (?P.*?) })''', - 'lilypond_block': + 'lilypond_block': r'''(?smx) ^[^%\n]*? (?P \\begin\s*( \[ - (?P.*?) + \s*(?P.*?)\s* \])?\s*{lilypond} (?P.*?) ^[^%\n]*? @@ -240,7 +240,7 @@ snippet_res = { (?P \\lilypondfile\s*( \[ - (?P.*?) + \s*(?P.*?)\s* \])?\s*\{ (?P\S+?) })''', @@ -288,7 +288,7 @@ snippet_res = { (?P @lilypond\s*( \[ - (?P.*?) + \s*(?P.*?)\s* \])?\s*{ (?P.*?) })''', @@ -298,7 +298,7 @@ snippet_res = { ^(?P @lilypond\s*( \[ - (?P.*?) + \s*(?P.*?)\s* \])?\s+? ^(?P.*?) ^@end\s+lilypond)\s''', @@ -308,7 +308,7 @@ snippet_res = { ^(?P @lilypondfile\s*( \[ - (?P.*?) + \s*(?P.*?)\s* \])?\s*{ (?P\S+) })''', @@ -592,7 +592,7 @@ def compose_ly (code, options): i = c if string.find (i, '=') > 0: - key, value = string.split (i, '=') + key, value = re.split ('\s*=\s*', i) override[key] = value else: key = i