Fix to urllib.parse.quote.
This commit is contained in:
parent
ca5c40f68b
commit
1c57c06596
@ -21,7 +21,7 @@
|
|||||||
import re
|
import re
|
||||||
import html
|
import html
|
||||||
from itertools import zip_longest
|
from itertools import zip_longest
|
||||||
import urllib
|
import urllib.parse.quote as urlquote
|
||||||
from html.entities import name2codepoint
|
from html.entities import name2codepoint
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
@ -422,7 +422,7 @@ def replaceExternalLinks(text):
|
|||||||
def makeExternalLink(url, anchor):
|
def makeExternalLink(url, anchor):
|
||||||
"""Function applied to wikiLinks"""
|
"""Function applied to wikiLinks"""
|
||||||
if Extractor.keepLinks:
|
if Extractor.keepLinks:
|
||||||
return '<a href="%s">%s</a>' % (urllib.quote(url.encode('utf-8')), anchor)
|
return '<a href="%s">%s</a>' % (urlquote(url.encode('utf-8')), anchor)
|
||||||
else:
|
else:
|
||||||
return anchor
|
return anchor
|
||||||
|
|
||||||
@ -492,7 +492,7 @@ def makeInternalLink(title, label):
|
|||||||
if colon2 > 1 and title[colon + 1:colon2] not in acceptedNamespaces:
|
if colon2 > 1 and title[colon + 1:colon2] not in acceptedNamespaces:
|
||||||
return ''
|
return ''
|
||||||
if Extractor.keepLinks:
|
if Extractor.keepLinks:
|
||||||
return '<a href="%s">%s</a>' % (urllib.quote(title), label)
|
return '<a href="%s">%s</a>' % (urlquote(title), label)
|
||||||
else:
|
else:
|
||||||
return label
|
return label
|
||||||
|
|
||||||
@ -1615,7 +1615,7 @@ parserFunctions = {
|
|||||||
|
|
||||||
# This function is used in some pages to construct links
|
# This function is used in some pages to construct links
|
||||||
# http://meta.wikimedia.org/wiki/Help:URL
|
# http://meta.wikimedia.org/wiki/Help:URL
|
||||||
'urlencode': lambda string, *rest: urllib.quote(string.encode('utf-8')),
|
'urlencode': lambda string, *rest: urlquote(string.encode('utf-8')),
|
||||||
|
|
||||||
'lc': lambda string, *rest: string.lower() if string else '',
|
'lc': lambda string, *rest: string.lower() if string else '',
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user