diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-03-02 20:58:09 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-03-03 00:31:18 +0200 |
commit | ae8b8bc81eab08b2ebe9f8c0957c085b5d45fc2b (patch) | |
tree | 551e90f993a83674faa367b776538c44704e78a6 /wikicvt.py | |
parent | 86ee544f442aa3c4a0516a620890ec64de0770cc (diff) | |
download | wikitrans-ae8b8bc81eab08b2ebe9f8c0957c085b5d45fc2b.tar.gz wikitrans-ae8b8bc81eab08b2ebe9f8c0957c085b5d45fc2b.tar.bz2 |
Rewrite from scratch. Text conversion almost(TM) works
Diffstat (limited to 'wikicvt.py')
-rw-r--r-- | wikicvt.py | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -29,34 +29,38 @@ usage: %s [-hvt] [-l lang] [-o kw=val] [--lang=lang] [--option kw=val] def main(): verbose_flag = 0 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) 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] == '-': kwdict['file'] = sys.stdin else: kwdict['filename'] = args[0] @@ -65,14 +69,14 @@ def main(): kwdict['lang']=lang if html: 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() |