summaryrefslogtreecommitdiffabout
path: root/wiki2html.py
authorSergey Poznyakoff <gray@gnu.org.ua>2015-07-15 21:12:35 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2015-07-15 21:12:35 (GMT)
commit45b2027439e96c366e188a12bd831802d30bbddc (patch) (side-by-side diff)
tree4333fb83ed667b1000f3d6bf71bc11b44e76c468 /wiki2html.py
parent6f963022315d4306f50f2e7046f2872cfd3c0500 (diff)
downloadwit-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 'wiki2html.py') (more/less context) (ignore whitespace changes)
-rw-r--r--wiki2html.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/wiki2html.py b/wiki2html.py
index 0330b92..05d4642 100644
--- a/wiki2html.py
+++ b/wiki2html.py
@@ -16,10 +16,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from wikimarkup import *
-from types import TupleType
from wikins import wiki_ns_re, wiki_ns
import re
-import urllib
+try:
+ from urllib import quote as url_quote
+except ImportError:
+ from urllib.parse import quote as url_quote
class HtmlWikiMarkup (WikiMarkup):
"""
@@ -48,7 +50,7 @@ class HtmlWikiMarkup (WikiMarkup):
def mktgt(self, tgt, lang = None):
if not lang:
lang = self.lang
- return self.html_base % { 'lang' : lang } + urllib.quote(tgt)
+ return self.html_base % { 'lang' : lang } + url_quote(tgt)
def tmpl_term(self, s):
if len(s) == 2:
@@ -84,7 +86,7 @@ class HtmlWikiMarkup (WikiMarkup):
arg = self.format(elt['content'][0])
text = None
if len(elt['content']) > 1:
- s = map(self.format, elt['content'])
+ s = [x for x in map(self.format, elt['content'])]
if s[0] == 'disambigR' or s[0] == 'wikiquote':
return ""
elif len(s) > 1 and s[1] == 'thumb':

Return to:

Send suggestions and report system problems to the System administrator.