aboutsummaryrefslogtreecommitdiff
path: root/wiki2text.py
diff options
context:
space:
mode:
Diffstat (limited to 'wiki2text.py')
-rw-r--r--wiki2text.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/wiki2text.py b/wiki2text.py
index 916391e..5041ea0 100644
--- a/wiki2text.py
+++ b/wiki2text.py
@@ -17,6 +17,10 @@
-from wikimarkup import *
-from wikins import wiki_ns_re, wiki_ns
+from wit.wikimarkup import *
+from wit.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
+
@@ -64,3 +68,3 @@ class TextWikiMarkup (WikiMarkup):
lang = self.lang
- return self.html_base % { 'lang' : lang } + urllib.quote(tgt)
+ return self.html_base % { 'lang' : lang } + url_quote(tgt)
@@ -89,4 +93,4 @@ class TextWikiMarkup (WikiMarkup):
tgt = self.image_base + '/' + \
- urllib.quote(tgt) + \
- '/250px-' + urllib.quote(tgt)
+ url_quote(tgt) + \
+ '/250px-' + url_quote(tgt)
elif ns == 'NS_MEDIA':
@@ -114,3 +118,3 @@ class TextWikiMarkup (WikiMarkup):
s = ""
- for elt in text.split('\n'):
+ for elt in text.decode("utf-8").split('\n'):
if elt:

Return to:

Send suggestions and report system problems to the System administrator.