From bbd80ffd2a9e17a9ccabd2fbc95a6b9fc51beb48 Mon Sep 17 00:00:00 2001
From: Werner Lemberg
Date: Sat, 16 Oct 2004 16:13:39 +0000
Subject: [PATCH] * scripts/lilypond-book.ly (snippet_res): Define group
`match' everywhere. Accept more spaces between commands and its arguments and
options. Fix some regexps. (output): Remove some newlines in string values
and suppress spaces in output. (output_texinfo): Output
`output_print_filename' only if not empty.
(Lilypond_snippet)[find_toplevel_snippets]: Use group `match'.
---
ChangeLog | 11 ++++
scripts/lilypond-book.py | 126 ++++++++++++++++++++-------------------
2 files changed, 75 insertions(+), 62 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6dda4af051..443a1d9030 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-10-16 Werner Lemberg
+
+ * scripts/lilypond-book.ly (snippet_res): Define group `match'
+ everywhere.
+ Accept more spaces between commands and its arguments and options.
+ Fix some regexps.
+ (output): Remove some newlines in string values and suppress spaces
+ in output.
+ (output_texinfo): Output `output_print_filename' only if not empty.
+ (Lilypond_snippet)[find_toplevel_snippets]: Use group `match'.
+
2004-10-16 Werner Lemberg
* scm/framework-tex.scm (font-load-command, define-fonts): Protect
diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py
index 3ae1c3926d..ff90a28659 100644
--- a/scripts/lilypond-book.py
+++ b/scripts/lilypond-book.py
@@ -179,27 +179,30 @@ snippet_res = {
)''',
'multiline_comment':
r'''(?smx)
+ (?P
\s*(?!@c\s+)
(?P)
- \s''',
+ \s)''',
'singleline_comment':
no_match,
'verb':
r'''(?x)
- (?P.*?
)''',
+ (?P
+ (?P.*?
))''',
'verbatim':
r'''(?x)
(?s)
- (?P\s.*?
\s)''',
+ (?P
+ (?P\s.*?
\s))''',
},
LATEX: {
'include':
- r'''(?mx)
+ r'''(?smx)
^[^%\n]*?
(?P
- \\input{
- (?P[^}]+)
+ \\input\s*{
+ (?P\S+?)
})''',
'lilypond':
r'''(?smx)
@@ -221,16 +224,16 @@ snippet_res = {
\])?\s*{lilypond}
(?P.*?)
^[^%\n]*?
- \\end{lilypond})''',
+ \\end\s*{lilypond})''',
'lilypond_file':
- r'''(?mx)
+ r'''(?smx)
^[^%\n]*?
(?P
\\lilypondfile\s*(
\[
(?P.*?)
\])?\s*\{
- (?P.+)
+ (?P\S+?)
})''',
'multiline_comment':
no_match,
@@ -239,65 +242,66 @@ snippet_res = {
^.*?
(?P
(?P
- ^%.*$\n+))''',
+ %.*$\n+))''',
'verb':
- r'''(?x)
- (?P
- \\verb(?P.)
- .*?
- (?P=del))''',
+ r'''(?mx)
+ ^[^%\n]*?
+ (?P
+ (?P
+ \\verb(?P.)
+ .*?
+ (?P=del)))''',
'verbatim':
- r'''(?sx)
- (?P
- \\begin\s*{verbatim}
- .*?
- \\end{verbatim})''',
+ r'''(?msx)
+ ^[^%\n]*?
+ (?P
+ (?P
+ \\begin\s*{verbatim}
+ .*?
+ \\end\s*{verbatim}))''',
},
TEXINFO: {
'include':
r'''(?mx)
- ^[^%\n]*?
- (?P
+ ^(?P
@include\s+
(?P\S+))''',
'lilypond':
- r'''(?mx)
- ^
+ r'''(?smx)
+ ^[^\n]*?(?!@c\s+)[^\n]*?
(?P
- @lilypond(
+ @lilypond\s*(
\[
- (?P[^]]*)
- \])?{
+ (?P.*?)
+ \])?\s*{
(?P.*?)
})''',
'lilypond_block':
r'''(?msx)
- ^
- (?P
- @lilypond(
+ ^(?P
+ @lilypond\s*(
\[
- (?P[^]]*)
- \])?\s
- (?P.*?)
- @end lilypond)\s''',
+ (?P.*?)
+ \])?\s+?
+ ^(?P.*?)
+ ^@end\s+lilypond)\s''',
'lilypond_file':
r'''(?mx)
- ^
- (?P
- @lilypondfile(
+ ^(?P
+ @lilypondfile\s*(
\[
- (?P[^]]*)
- \])?{
- (?P[^}]+)
+ (?P.*?)
+ \])?\s*{
+ (?P\S+)
})''',
'multiline_comment':
r'''(?smx)
- ^\s*(?!@c\s+)
- (?P
- @ignore
- \s.*?
- @end\s+ignore)\s''',
+ ^(?P
+ (?P
+ @ignore\s
+ .*?
+ @end\s+ignore))\s''',
'singleline_comment':
r'''(?mx)
^.*
@@ -309,10 +313,11 @@ snippet_res = {
# 'verb': r'''(?P@code{.*?})''',
'verbatim':
r'''(?sx)
- (?P
- @example
- \s.*?
- @end\s+example\s)''',
+ (?P
+ (?P
+ @example
+ \s.*?
+ @end\s+example\s))''',
},
}
@@ -378,8 +383,7 @@ output = {
AFTER: r'''
''',
- BEFORE: r'''
-
+ BEFORE: r'''
''',
OUTPUT: r'''
![]()