program_version = '@TOPLEVEL_VERSION@'
if program_version == '@' + 'TOPLEVEL_VERSION' + '@':
- program_version = '1.4pre'
+ program_version = '1.5.18'
#
# Try to cater for bad installations of LilyPond, that have
elif name[-5:] == 'paper':
self.m_papersize = name
else:
- self._set_dimen('m_geo_'+name, value)
+ pass
+ # what is _set_dimen ?? /MB
+ #self._set_dimen('m_geo_'+name, value)
def __setattr__(self, name, value):
if type(value) == type("") and \
dimension_conversion_dict.has_key (value[-2:]):
- f = dimension_conversion_dict[dim]
+ f = dimension_conversion_dict[value[-2:]]
self.__dict__[name] = f(float(value[:-2]))
else:
self.__dict__[name] = value
'output-default-pre': "\\def\preLilypondExample{}\n",
'usepackage-graphics': '\\usepackage{graphics}\n',
'output-eps': '\\noindent\\parbox{\\lilypondepswidth{%(fn)s.eps}}{\includegraphics{%(fn)s.eps}}',
- 'output-tex': '\\preLilypondExample \\input %(fn)s.tex \\postLilypondExample\n',
+ 'output-tex': '{\\preLilypondExample \\input %(fn)s.tex \\postLilypondExample\n}',
'pagebreak': r'\pagebreak',
},
'texi' : {'output-lilypond': """@lilypond[%s]
@end tex
@html
<p>
-<img src=%(fn)s.png>
+<a href="%(fn)s.png">
+<img border=0 src="%(fn)s.png" alt="[picture of music]">
+</a>
@end html
""",
}
re_dict = {
'latex': {'input': r'(?m)^[^%\n]*?(?P<match>\\mbinput{?([^}\t \n}]*))',
'include': r'(?m)^[^%\n]*?(?P<match>\\mbinclude{(?P<filename>[^}]+)})',
- 'option-sep' : ', *',
+ 'option-sep' : ',\s*',
'header': r"\\documentclass\s*(\[.*?\])?",
'geometry': r"^(?m)[^%\n]*?\\usepackage\s*(\[(?P<options>.*)\])?\s*{geometry}",
'preamble-end': r'(?P<code>\\begin{document})',
'verbatim': r"(?s)(?P<code>\\begin{verbatim}.*?\\end{verbatim})",
'verb': r"(?P<code>\\verb(?P<del>.).*?(?P=del))",
- 'lilypond-file': r'(?m)^[^%\n]*?(?P<match>\\lilypondfile(\[(?P<options>.*?)\])?\{(?P<filename>.+)})',
- 'lilypond' : r'(?m)^[^%\n]*?(?P<match>\\lilypond(\[(?P<options>.*?)\])?{(?P<code>.*?)})',
- 'lilypond-block': r"(?sm)^[^%\n]*?(?P<match>\\begin(\[(?P<options>.*?)\])?{lilypond}(?P<code>.*?)\\end{lilypond})",
+ 'lilypond-file': r'(?m)^[^%\n]*?(?P<match>\\lilypondfile\s*(\[(?P<options>.*?)\])?\s*\{(?P<filename>.+)})',
+ 'lilypond' : r'(?m)^[^%\n]*?(?P<match>\\lilypond\s*(\[(?P<options>.*?)\])?\s*{(?P<code>.*?)})',
+ 'lilypond-block': r"(?sm)^[^%\n]*?(?P<match>\\begin\s*(\[(?P<options>.*?)\])?\s*{lilypond}(?P<code>.*?)\\end{lilypond})",
'def-post-re': r"\\def\\postLilypondExample",
'def-pre-re': r"\\def\\preLilypondExample",
'usepackage-graphics': r"\usepackage{graphics}",
'lilypond-file': '(?m)^(?!@c)(?P<match>@lilypondfile(\[(?P<options>.*?)\])?{(?P<filename>[^}]+)})',
'lilypond' : '(?m)^(?!@c)(?P<match>@lilypond(\[(?P<options>.*?)\])?{(?P<code>.*?)})',
'lilypond-block': r"""(?m)^(?!@c)(?P<match>(?s)(?P<match>@lilypond(\[(?P<options>.*?)\])?\s(?P<code>.*?)@end lilypond\s))""",
- 'option-sep' : ', *',
+ 'option-sep' : ',\s*',
'intertext': r',?\s*intertext=\".*?\"',
'multiline-comment': r"(?sm)^\s*(?!@c\s+)(?P<code>@ignore\s.*?@end ignore)\s",
'singleline-comment': r"(?m)^.*?(?P<match>(?P<code>@c.*$\n+))",
optstring = re.sub ('\n', ' ', optstring)
body = r"""
%% Generated automatically by: lilypond-book.py
-%% options are %s %%ughUGH not original options
+%% options are %s
\include "paper%d.ly"
\paper { linewidth = %f \pt }
""" % (optstring, music_size, l) + body
+
+ # ughUGH not original options
return body
def parse_options_string(s):
if do_deps:
depfiles=map (lambda x: re.sub ('(.*)\.ly', '\\1.dep', x), tex)
for i in depfiles:
- text=open (i).read ()
+ f =open (i)
+ text=f.read ()
+ f.close ()
text=re.sub ('\n([^:\n]*):', '\n' + foutn + ':', text)
- open (i, 'w').write (text)
+ f = open (i, 'w')
+ f.write (text)
+ f.close ()
for e in eps:
system(r"tex '\nonstopmode \input %s'" % e)