File: html.py

package info (click to toggle)
zope-devguide 20011206-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 456 kB
  • ctags: 45
  • sloc: python: 152; makefile: 124; sh: 54
file content (21 lines) | stat: -rw-r--r-- 512 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/python
import sys
import os.path
from StructuredText import HTMLWithImages, DocumentWithImages, Basic

if not sys.argv[1:]:
    print """
Usage: html.py <file.stx>...

Converts one or more structured text (.stx) files to html files.
"""

for filename in sys.argv[1:]:
    htmlfile="%s.html" % os.path.splitext(filename)[0]
    print "%s -> %s" % (filename, htmlfile)
    f=open(htmlfile, 'wb')
    f.write(HTMLWithImages(DocumentWithImages(Basic(open(filename).read()))))
    f.close()