From 78ca5469481f5a80b3a97f34482d0e744abbf948 Mon Sep 17 00:00:00 2001 From: Tom Most Date: Thu, 18 Jul 2019 23:16:13 -0700 Subject: [PATCH] Sanitizer: Allow Add tests that the sanitizer allows
and and update the implementation to allow . --- CHANGES.rst | 7 +++++++ html5lib/filters/sanitizer.py | 1 + html5lib/tests/test_sanitizer.py | 12 ++++++++++++ 3 files changed, 20 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 82605a21..e2647b8d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,13 @@ Change Log ---------- +1.1.0 +~~~~~ + +Bug fixes: + +* The sanitizer now permits ```` tags. + 1.0.1 ~~~~~ diff --git a/html5lib/filters/sanitizer.py b/html5lib/filters/sanitizer.py index e852f53b..50e3ab91 100644 --- a/html5lib/filters/sanitizer.py +++ b/html5lib/filters/sanitizer.py @@ -96,6 +96,7 @@ (namespaces['html'], 'strike'), (namespaces['html'], 'strong'), (namespaces['html'], 'sub'), + (namespaces['html'], 'summary'), (namespaces['html'], 'sup'), (namespaces['html'], 'table'), (namespaces['html'], 'tbody'), diff --git a/html5lib/tests/test_sanitizer.py b/html5lib/tests/test_sanitizer.py index 45046d57..0346f60d 100644 --- a/html5lib/tests/test_sanitizer.py +++ b/html5lib/tests/test_sanitizer.py @@ -115,6 +115,18 @@ def test_sanitizer(): """foo""" % (protocol, rest_of_uri)) +def test_details_open_allowed(): + sanitized = sanitize_html("
.
") + expected = '
.
' + assert expected == sanitized + + +def test_details_summary_allowed(): + sanitized = sanitize_html("
.

...

") + expected = '
.

...

' + assert expected == sanitized + + def test_lowercase_color_codes_in_style(): sanitized = sanitize_html("

") expected = '

'