FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Don't sanitize <summary> by twm · Pull Request #423 · html5lib/html5lib-python · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 7 additions & 1 deletion CHANGES.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Change Log
----------

1.2
~~~

Bug fixes:

* The sanitizer now permits ``<summary>`` tags.

1.1
~~~

Expand All @@ -22,7 +29,6 @@ Other changes:
``html5lib`` keeps working in future Python versions. (#403)
* Drop optional ``datrie`` dependency. (#442)


1.0.1
~~~~~

Expand Down
1 change: 1 addition & 0 deletions html5lib/filters/sanitizer.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
(namespaces['html'], 'strike'),
(namespaces['html'], 'strong'),
(namespaces['html'], 'sub'),
(namespaces['html'], 'summary'),
(namespaces['html'], 'sup'),
(namespaces['html'], 'table'),
(namespaces['html'], 'tbody'),
Expand Down
12 changes: 12 additions & 0 deletions html5lib/tests/test_sanitizer.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ def param_sanitizer():
"""<img src="%s:%s">foo</a>""" % (protocol, rest_of_uri))


def test_details_open_allowed():
sanitized = sanitize_html("<details open>.</details>")
expected = '<details open>.</details>'
assert expected == sanitized


def test_details_summary_allowed():
sanitized = sanitize_html("<details><summary>.</summary><p>...</p></details>")
expected = '<details><summary>.</summary><p>...</p></details>'
assert expected == sanitized


@pytest.mark.parametrize("expected, input",
(pytest.param(expected, input, id=id)
for id, expected, input in param_sanitizer()))
Expand Down

Back | FazBrowse Home | New Git URL