5 from librarian import html, ParseError
8 if __name__ == '__main__':
9 # Parse commandline arguments
10 usage = """Usage: %prog [options] SOURCE [SOURCE...]
11 Convert SOURCE files to HTML format."""
13 parser = optparse.OptionParser(usage=usage)
15 parser.add_option('-v', '--verbose', action='store_true', dest='verbose', default=False,
16 help='print status messages to stdout')
18 options, input_filenames = parser.parse_args()
20 if len(input_filenames) < 1:
25 for input_filename in input_filenames:
29 output_filename = os.path.splitext(input_filename)[0] + '.html'
31 html.transform(input_filename, output_filename)
33 print '%(file)s:%(name)s:%(message)s' % {
34 'file': input_filename,
35 'name': e.__class__.__name__,
39 print '%(file)s:%(name)s:%(message)s' % {
40 'file': input_filename,
41 'name': e.__class__.__name__,
42 'message': e.strerror,
44 except BaseException, e:
45 print '%(file)s:%(etype)s:%(message)s' % {
46 'file': input_filename,
47 'etype': e.__class__.__name__,