p.add_option ("-o", '--output', help=_('write output to DIR'),
metavar="DIR",
- action='store', dest='output_name', default=None)
+ action='store', dest='output_name',
+ default='')
p.add_option ('-P', '--process', metavar=_("COMMAND"),
help = _ ("process ly_files using COMMAND FILE..."),
action='store',
@end html
''',
- PRINTFILENAME: '''@file{%(filename)s}
+ PRINTFILENAME: '''
+@html
+<a href="%(base)s.ly">
+@end html
+@file{%(filename)s}
+@html
+</a>
+@end html
''',
QUOTE: r'''@quotation
# Do we need anything else besides `textwidth'?
def get_latex_textwidth (source):
m = re.search (r'''(?P<preamble>\\begin\s*{document})''', source)
+ if m == None:
+ warning (_ ("Can't find \\begin{document} in LaTeX document"))
+
+ ## what's a sensible default?
+ return 550.0
+
preamble = source[:m.start (0)]
latex_document = LATEX_INSPECTION_DOCUMENT % vars ()
inputs.append (name)
return inputs
+def samefile (f1, f2):
+ try:
+ return os.path.samefile (f1, f2)
+ except AttributeError: # Windoze
+ f1 = re.sub ("//*", "/", f1)
+ f2 = re.sub ("//*", "/", f2)
+ return f1 == f2
+
def do_file (input_filename):
# Ugh.
if not input_filename or input_filename == '-':
else:
if os.path.exists (input_filename) \
and os.path.exists (output_filename) \
- and os.path.samefile (output_filename, input_fullname):
+ and samefile (output_filename, input_fullname):
error (
_ ("Output would overwrite input file; use --output."))
exit (2)