Added numbering requirements to README.
[wolnelektury.git] / lib / librarian / bin / book2html.py
1 #!/usr/bin/env python
2 import os
3 import optparse
4
5 from librarian import html
6
7
8 if __name__ == '__main__':
9     # Parse commandline arguments
10     usage = """Usage: %prog [options] SOURCE [SOURCE...]
11     Convert SOURCE files to HTML format."""
12
13     parser = optparse.OptionParser(usage=usage)
14
15     parser.add_option('-v', '--verbose', action='store_true', dest='verbose', default=False,
16         help='print status messages to stdout')
17
18     options, input_filenames = parser.parse_args()
19
20     if len(input_filenames) < 1:
21         parser.print_help()
22         exit(1)
23
24     # Do some real work
25     for input_filename in input_filenames:
26         if options.verbose:
27             print input_filename
28         
29         output_filename = os.path.splitext(input_filename)[0] + '.html'
30         html.transform(input_filename, output_filename)
31