diff --git a/ox/html.py b/ox/html.py index 815f657..13524fd 100644 --- a/ox/html.py +++ b/ox/html.py @@ -6,8 +6,10 @@ import string from six.moves.html_entities import name2codepoint from six import unichr, PY2, string_types +letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' # Configuration for add_links() function + LEADING_PUNCTUATION = ['(', '<', '<'] TRAILING_PUNCTUATION = ['.', ',', ')', '>', '\n', '>', "'", '"'] @@ -89,7 +91,7 @@ def add_links(text, trim_url_limit=None, nofollow=False): if match: lead, middle, trail = match.groups() if middle.startswith('www.') or ('@' not in middle and not middle.startswith('http://') and \ - len(middle) > 0 and middle[0] in string.letters + string.digits and \ + len(middle) > 0 and middle[0] in letters + string.digits and \ (middle.endswith('.org') or middle.endswith('.net') or middle.endswith('.com'))): middle = '%s' % (middle, nofollow_attr, trim_url(middle)) if middle.startswith('http://') or middle.startswith('https://'):