4
Usage = """examplePy2wiki - generating a wiki text out of a python example
7
examplePy2wiki [Optionen]
10
-o --out-file=FILENAME use this file name for output, default resources.qrc
11
-i, --in-file=FILENAME directory to search, default PWD
12
-h, --help print this help message
14
This program reads python files and generate a output suited for a Mediawiki page.
15
The python comments get translated to text and the code blocks get intended to
16
show up us code in the wiki.
20
(c) 2009 Juergen Riegel
28
import os, sys, string, getopt
41
opts, args = getopt.getopt(
42
sys.argv[1:], "hi:o:", ["help", "verbose", "in-file=", "out-file="]
44
except getopt.GetoptError:
46
sys.stderr.write(Usage)
51
if o in ("-h", "--help"):
52
sys.stderr.write(Usage)
54
if o in ("-o", "--out-file"):
55
outfile = open(a, "w")
56
if o in ("-i", "--in-file"):
59
lines = infile.readlines()
61
outfile.write(Process(l))
65
if __name__ == "__main__":