diff options
Diffstat (limited to 'wiki2html.py')
-rw-r--r-- | wiki2html.py | 10 |
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': |