]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scripts/lilypond-book.py (snippet_res): Fix regexps and make them ignore
authorWerner Lemberg <wl@gnu.org>
Mon, 25 Oct 2004 20:46:09 +0000 (20:46 +0000)
committerWerner Lemberg <wl@gnu.org>
Mon, 25 Oct 2004 20:46:09 +0000 (20:46 +0000)
whitespace properly.
(compose_ly): Use `re.split' instead of `string.split' to remove surrounding
whitespace.

ChangeLog
scripts/lilypond-book.py

index 8671d43f2de81d76017ca5b296da8567c0594a88..5dbb46b742c23b3f5ea3367b8aae7a24013b0f96 100644 (file)
--- 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  <hanwen@xs4all.nl>
index cc1b8e98d3575d1a2ce4bb202e74f18db5a8a6d0..ace30b4cf530f9424b5ecfff000a0a600f57414f 100644 (file)
@@ -157,7 +157,7 @@ snippet_res = {
                  r'''(?mx)
                    (?P<match>
                    <lilypond
-                     ((?P<options>[^:]*):)
+                     (\s*(?P<options>.*?)\s*:)?\s*
                      (?P<code>.*?)
                    />)''',
 
@@ -165,7 +165,7 @@ snippet_res = {
                  r'''(?msx)
                    (?P<match>
                    <lilypond
-                     (?P<options>[^>]+)?
+                     \s*(?P<options>.*?)\s*
                    >
                    (?P<code>.*?)
                    </lilypond>)''',
@@ -174,9 +174,9 @@ snippet_res = {
                  r'''(?mx)
                    (?P<match>
                    <lilypondfile
-                     (?P<options>[^>]+)?
-                   >\s*
-                     (?P<filename>[^<]+)\s*
+                     \s*(?P<options>.*?)\s*
+                   >
+                   \s*(?P<filename>.*?)\s*
                    </lilypondfile>)''',
 
                'multiline_comment':
@@ -211,24 +211,24 @@ snippet_res = {
                      (?P<filename>\S+?)
                    })''',
 
-       'lilypond':
+               'lilypond':
                  r'''(?smx)
                    ^[^%\n]*?
                    (?P<match>
                    \\lilypond\s*(
                    \[
-                     (?P<options>.*?)
+                     \s*(?P<options>.*?)\s*
                    \])?\s*{
                      (?P<code>.*?)
                    })''',
 
-       'lilypond_block':
+               'lilypond_block':
                  r'''(?smx)
                    ^[^%\n]*?
                    (?P<match>
                    \\begin\s*(
                    \[
-                     (?P<options>.*?)
+                     \s*(?P<options>.*?)\s*
                    \])?\s*{lilypond}
                      (?P<code>.*?)
                    ^[^%\n]*?
@@ -240,7 +240,7 @@ snippet_res = {
                    (?P<match>
                    \\lilypondfile\s*(
                    \[
-                     (?P<options>.*?)
+                     \s*(?P<options>.*?)\s*
                    \])?\s*\{
                      (?P<filename>\S+?)
                    })''',
@@ -288,7 +288,7 @@ snippet_res = {
                    (?P<match>
                    @lilypond\s*(
                    \[
-                     (?P<options>.*?)
+                     \s*(?P<options>.*?)\s*
                    \])?\s*{
                      (?P<code>.*?)
                    })''',
@@ -298,7 +298,7 @@ snippet_res = {
                    ^(?P<match>
                    @lilypond\s*(
                    \[
-                     (?P<options>.*?)
+                     \s*(?P<options>.*?)\s*
                    \])?\s+?
                    ^(?P<code>.*?)
                    ^@end\s+lilypond)\s''',
@@ -308,7 +308,7 @@ snippet_res = {
                    ^(?P<match>
                    @lilypondfile\s*(
                    \[
-                     (?P<options>.*?)
+                     \s*(?P<options>.*?)\s*
                    \])?\s*{
                      (?P<filename>\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