Commit f4baeb5c authored by Brett Wilkins's avatar Brett Wilkins

mt2mw/page: removing link munging code

Bug filed for perl HTML::WikiConverter module on CPAN with
a patch which should be used instead:
https://rt.cpan.org/Public/Bug/Display.html?id=58415
parent 3a2a4b8a
......@@ -101,14 +101,5 @@ def html2wiki(html):
out, err = converter.communicate(input=html)
if err:
raise Exception(err)
# the HTML::WikiConverter module does something funny with urlencoded characters
# in the link portion of a wiki link. The title portion appears to be fine
# we need to replace sets of two consecutive url-encoded characters (4 bytes)
# with the outer two bytes, when those sets are found between
out = urllib2.quote(out)
links = re.findall('%5B%5B(.*?)%7C.*?%5B%5B', out)
for link in links:
fixedlink = re.sub('((%[0-9A-F]{2}){4})', reducechars, link)
out = out.replace(link, fixedlink)
return urllib2.unquote(out)
return out
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment