whitespace properly.
(compose_ly): Use `re.split' instead of `string.split' to remove surrounding
whitespace.
* 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>
r'''(?mx)
(?P<match>
<lilypond
- ((?P<options>[^:]*):)
+ (\s*(?P<options>.*?)\s*:)?\s*
(?P<code>.*?)
/>)''',
r'''(?msx)
(?P<match>
<lilypond
- (?P<options>[^>]+)?
+ \s*(?P<options>.*?)\s*
>
(?P<code>.*?)
</lilypond>)''',
r'''(?mx)
(?P<match>
<lilypondfile
- (?P<options>[^>]+)?
- >\s*
- (?P<filename>[^<]+)\s*
+ \s*(?P<options>.*?)\s*
+ >
+ \s*(?P<filename>.*?)\s*
</lilypondfile>)''',
'multiline_comment':
(?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]*?
(?P<match>
\\lilypondfile\s*(
\[
- (?P<options>.*?)
+ \s*(?P<options>.*?)\s*
\])?\s*\{
(?P<filename>\S+?)
})''',
(?P<match>
@lilypond\s*(
\[
- (?P<options>.*?)
+ \s*(?P<options>.*?)\s*
\])?\s*{
(?P<code>.*?)
})''',
^(?P<match>
@lilypond\s*(
\[
- (?P<options>.*?)
+ \s*(?P<options>.*?)\s*
\])?\s+?
^(?P<code>.*?)
^@end\s+lilypond)\s''',
^(?P<match>
@lilypondfile\s*(
\[
- (?P<options>.*?)
+ \s*(?P<options>.*?)\s*
\])?\s*{
(?P<filename>\S+)
})''',
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