summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2017-03-28 11:41:17 -0700
committerZac Medico <zmedico@gentoo.org>2017-03-28 12:05:34 -0700
commitb056103962b4ecff159549327f4b5219ebdfafaf (patch)
tree48cede4e9dadca862f06756594492fbdabb49e89 /dev-python/html5lib/files
parentdev-libs/libzip: D -> ED (diff)
downloadgentoo-b056103962b4ecff159549327f4b5219ebdfafaf.tar.gz
gentoo-b056103962b4ecff159549327f4b5219ebdfafaf.tar.bz2
gentoo-b056103962b4ecff159549327f4b5219ebdfafaf.zip
dev-python/html5lib: fix for python3.6 (bug 613656)
Package-Manager: Portage-2.3.5, Repoman-2.3.2
Diffstat (limited to 'dev-python/html5lib/files')
-rw-r--r--dev-python/html5lib/files/html5lib-0.9999999-python3.6-sanitizer-re.patch50
1 files changed, 50 insertions, 0 deletions
diff --git a/dev-python/html5lib/files/html5lib-0.9999999-python3.6-sanitizer-re.patch b/dev-python/html5lib/files/html5lib-0.9999999-python3.6-sanitizer-re.patch
new file mode 100644
index 000000000000..c64cbe1ab3f5
--- /dev/null
+++ b/dev-python/html5lib/files/html5lib-0.9999999-python3.6-sanitizer-re.patch
@@ -0,0 +1,50 @@
+--- a/html5lib/sanitizer.py
++++ b/html5lib/sanitizer.py
+@@ -203,7 +203,7 @@
+ for attr in self.attr_val_is_uri:
+ if attr not in attrs:
+ continue
+- val_unescaped = re.sub("[`\000-\040\177-\240\s]+", '',
++ val_unescaped = re.sub(r"[`\000-\040\177-\240\s]+", '',
+ unescape(attrs[attr])).lower()
+ # remove replacement characters from unescaped characters
+ val_unescaped = val_unescaped.replace("\ufffd", "")
+@@ -228,7 +228,7 @@
+ ' ',
+ unescape(attrs[attr]))
+ if (token["name"] in self.svg_allow_local_href and
+- 'xlink:href' in attrs and re.search('^\s*[^#\s].*',
++ 'xlink:href' in attrs and re.search(r'^\s*[^#\s].*',
+ attrs['xlink:href'])):
+ del attrs['xlink:href']
+ if 'style' in attrs:
+@@ -257,16 +257,16 @@
+
+ def sanitize_css(self, style):
+ # disallow urls
+- style = re.compile('url\s*\(\s*[^\s)]+?\s*\)\s*').sub(' ', style)
++ style = re.compile(r'url\s*\(\s*[^\s)]+?\s*\)\s*').sub(' ', style)
+
+ # gauntlet
+- if not re.match("""^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$""", style):
++ if not re.match(r"""^([:,;#%.\sa-zA-Z0-9!]|\w-\w|'[\s\w]+'|"[\s\w]+"|\([\d,\s]+\))*$""", style):
+ return ''
+- if not re.match("^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$", style):
++ if not re.match(r"^\s*([-\w]+\s*:[^:;]*(;\s*|$))*$", style):
+ return ''
+
+ clean = []
+- for prop, value in re.findall("([-\w]+)\s*:\s*([^:;]*)", style):
++ for prop, value in re.findall(r"([-\w]+)\s*:\s*([^:;]*)", style):
+ if not value:
+ continue
+ if prop.lower() in self.allowed_css_properties:
+@@ -275,7 +275,7 @@
+ 'padding']:
+ for keyword in value.split():
+ if keyword not in self.acceptable_css_keywords and \
+- not re.match("^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", keyword):
++ not re.match(r"^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$", keyword):
+ break
+ else:
+ clean.append(prop + ': ' + value + ';')