summaryrefslogtreecommitdiffabout
path: root/wikicvt.py
authorSergey Poznyakoff <gray@gnu.org.ua>2009-03-02 18:58:09 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2009-03-02 22:31:18 (GMT)
commitae8b8bc81eab08b2ebe9f8c0957c085b5d45fc2b (patch) (side-by-side diff)
tree551e90f993a83674faa367b776538c44704e78a6 /wikicvt.py
parent86ee544f442aa3c4a0516a620890ec64de0770cc (diff)
downloadwikitrans-ae8b8bc81eab08b2ebe9f8c0957c085b5d45fc2b.tar.gz
wikitrans-ae8b8bc81eab08b2ebe9f8c0957c085b5d45fc2b.tar.bz2
Rewrite from scratch. Text conversion almost(TM) works
Diffstat (limited to 'wikicvt.py') (more/less context) (ignore whitespace changes)
-rw-r--r--wikicvt.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/wikicvt.py b/wikicvt.py
index 758bcb1..a2e95e4 100644
--- a/wikicvt.py
+++ b/wikicvt.py
@@ -32,9 +32,11 @@ def main():
html = 1
lang = "pl"
kwdict = {}
+ debug = 0
+
try:
- opts, args = getopt.getopt(sys.argv[1:], "hl:o:tv",
- ["help", "lang=", "option=",
+ opts, args = getopt.getopt(sys.argv[1:], "d:hl:o:tv",
+ ["debug=", "help", "lang=", "option=",
"text", "input-text", "verbose" ])
except getopt.GetoptError:
usage(1)
@@ -42,18 +44,20 @@ def main():
for o, a in opts:
if o in ("-h", "--help"):
usage()
- if o in ("-v", "--verbose"):
+ elif o in ("-v", "--verbose"):
verbose_flag = verbose_flag + 1
- if o in ("-t", "--text"):
+ elif o in ("-t", "--text"):
html = 0
- if o in ("-l", "--lang"):
+ elif o in ("-l", "--lang"):
lang = a
- if o in ("-o", "--option"):
+ elif o in ("-o", "--option"):
(kw,sep,val) = a.partition('=')
if val != '':
kwdict[kw] = eval(val)
- if o == "--input-text":
+ elif o == "--input-text":
input_text = True
+ elif o in ("-d", "--debug"):
+ debug = eval(a)
if len(args) == 1:
if args[0] == '-':
@@ -68,11 +72,11 @@ def main():
markup = HtmlWiktionaryMarkup(**kwdict)
else:
markup = TextWiktionaryMarkup(**kwdict)
-
+ markup.debug_level = debug
markup.parse()
print str(markup)
- if verbose_flag > 0:
- markup.output()
+# if verbose_flag > 0:
+# markup.output()
if __name__ == '__main__':
main()

Return to:

Send suggestions and report system problems to the System administrator.