<a href="%(base)s.ly">''',
OUTPUT: r'''
<img align="center" valign="center"
- border="0" src="%(picture)s" alt="[picture of music]">''',
+ border="0" src="%(image)s" alt="[image of music]">''',
PRINTFILENAME:'<p><tt><a href="%(base)s.ly">%(filename)s</a></tt></p>',
VERBATIM: r'''<pre>
%(verb)s</pre>''',
},
-
+
LATEX : {
AFTER: '',
BEFORE: '',
%(verb)s\end{verbatim}
''',
},
-
- TEXINFO : {
+
+ TEXINFO : {
AFTER: '',
BEFORE: '',
+ OUTPUT: r'''
+ @image{%(base)s,,,[image of music],%(ext)s}
+''',
PRINTFILENAME: '''@file{%(filename)s}
''',
VERBATIM: r'''@example
%(verb)s@end example
''',
-
},
-
}
PREAMBLE_LY = r'''%% Generated by %(program_name)s
func = Lilypond_snippet.__dict__ ['output_' + self.format]
return func (self)
- def output_html (self):
+ def get_images (self):
base = self.basename ()
- str = ''
- if format == HTML:
- str = self.output_print_filename (HTML)
- if VERBATIM in self.options:
- verb = verbatim_html (self.substring ('code'))
- str += write (output[HTML][VERBATIM] % vars ())
-
# URGUGHUGHUGUGHU
single = '%(base)s.png' % vars ()
multiple = '%(base)s-page1.png' % vars ()
- pictures = (single,)
+ images = (single,)
if os.path.exists (multiple) \
and (not os.path.exists (single)\
or (os.stat (multiple)[stat.ST_MTIME] \
> os.stat (single)[stat.ST_MTIME])):
- pictures = glob.glob ('%(base)s-page*.png' % vars ())
+ images = glob.glob ('%(base)s-page*.png' % vars ())
+ return images
+ def output_html (self):
+ base = self.basename ()
+ str = ''
+ if format == HTML:
+ str = self.output_print_filename (HTML)
+ if VERBATIM in self.options:
+ verb = verbatim_html (self.substring ('code'))
+ str += write (output[HTML][VERBATIM] % vars ())
+
str += output[HTML][BEFORE] % vars ()
- for picture in pictures:
+ for image in self.get_images ():
+ base, ext = os.path.splitext (image)
str += output[HTML][OUTPUT] % vars ()
str += output[HTML][AFTER] % vars ()
return str
-
+
+ def output_info (self):
+ str = output[TEXINFO][BEFORE] % vars ()
+ for image in self.get_images ():
+ base, ext = os.path.splitext (image)
+ # URG, makeinfo implicitely prepends dot to ext
+ # specifying no extension is most robust
+ ext = ''
+ str += output[TEXINFO][OUTPUT] % vars ()
+ str += output[TEXINFO][AFTER] % vars ()
+ return str
+
def output_latex (self):
str = ''
base = self.basename ()
verb = verbatim_texinfo (self.substring ('code'))
str += (output[TEXINFO][VERBATIM] % vars ())
+ str += ('@ifinfo\n' + self.output_info () + '\n@end ifinfo\n')
str += ('@tex\n' + self.output_latex () + '\n@end tex\n')
str += ('@html\n' + self.output_html () + '\n@end html\n')
- # need par after picture
+ # need par after image
str += '\n'
return str