RegexLinkExtractor: add \x0c to whitespace characters, as per html5 standard

This commit is contained in:
Mikhail Korobov 2017-02-08 16:58:38 +05:00
parent e1ceaf3b5f
commit ad36a4a6ae
1 changed files with 2 additions and 1 deletions

View File

@ -10,9 +10,10 @@ linkre = re.compile(
"<a\s.*?href=(\"[.#]+?\"|\'[.#]+?\'|[^\s]+?)(>|\s.*?>)(.*?)<[/ ]?a>",
re.DOTALL | re.IGNORECASE)
def clean_link(link_text):
"""Remove leading and trailing whitespace and punctuation"""
return link_text.strip("\t\r\n '\"")
return link_text.strip("\t\r\n '\"\x0c")
class RegexLinkExtractor(SgmlLinkExtractor):