diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-07-16 00:12:35 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-07-16 00:12:35 +0300 |
commit | 45b2027439e96c366e188a12bd831802d30bbddc (patch) | |
tree | 4333fb83ed667b1000f3d6bf71bc11b44e76c468 /wikicvt.py | |
parent | 6f963022315d4306f50f2e7046f2872cfd3c0500 (diff) | |
download | wit-45b2027439e96c366e188a12bd831802d30bbddc.tar.gz wit-45b2027439e96c366e188a12bd831802d30bbddc.tar.bz2 |
Support for Python 3
* wiki2html.py: Import urllib.parse if importing urllib fails.
Use list comprehensions to build lists from maps.
* wiki2texi.py: Use 'in' instead of has_key.
Use list comprehensions to build lists from maps.
* wiki2text.py: Likewise.
* wikicvt.py: Use print function.
Import StringIO from io if unable to import is as a module
* wikimarkup.py: Use print function.
Fix some UTF strings.
Diffstat (limited to 'wikicvt.py')
-rwxr-xr-x | wikicvt.py | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -17,5 +17,9 @@ +from __future__ import print_function import sys import getopt -import StringIO +try: + from StringIO import StringIO +except ImportError: + from io import StringIO from wiki2html import * @@ -27,3 +31,3 @@ class DumpWikiMarkup (WikiMarkup): if self.tree: - s = StringIO.StringIO() + s = StringIO() self.dump(self.tree, 0, s) @@ -34,6 +38,6 @@ class DumpWikiMarkup (WikiMarkup): def usage(code=0): - print """ -usage: %s [-hvt] [-I INTYPE] [-l lang] [-o kw=val] [--lang=lang] [--option kw=val] - [--input-type=INTYPE] [--type=OUTTYPE] [--help] [--verbose] file -""" % (sys.argv[0]) + print("""usage: %s [-hvt] [-I INTYPE] [-l lang] [-o kw=val] [--lang=lang] + [--option kw=val] [--input-type=INTYPE] [--type=OUTTYPE] [--help] + [--verbose] file +""" % sys.argv[0]) sys.exit(code) @@ -111,8 +115,8 @@ def main(): markup.parse() - print str(markup) + print("%s" % str(markup)) exit(0) else: - print "unsupported input type: %s" % (itype) + print("unsupported input type: %s" % itype) else: - print "unsupported output type: %s" % (otype) + print("unsupported output type: %s" % otype) exit(1) |