Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitff7fa37

Browse files
twmambv
andauthored
Sanitizer: Allow <summary> (#423)
Add tests that the sanitizer allows <details open> and <summary> andupdate the implementation to allow <summary>.Co-authored-by: Łukasz Langa <lukasz@langa.pl>
1 parentc64a111 commitff7fa37

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

‎CHANGES.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Change Log
22
----------
33

4+
1.2
5+
~~~
6+
7+
Bug fixes:
8+
9+
* The sanitizer now permits ``<summary>`` tags.
10+
411
1.1
512
~~~
613

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

25-
2632
1.0.1
2733
~~~~~
2834

‎html5lib/filters/sanitizer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
(namespaces['html'],'strike'),
114114
(namespaces['html'],'strong'),
115115
(namespaces['html'],'sub'),
116+
(namespaces['html'],'summary'),
116117
(namespaces['html'],'sup'),
117118
(namespaces['html'],'table'),
118119
(namespaces['html'],'tbody'),

‎html5lib/tests/test_sanitizer.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,18 @@ def param_sanitizer():
111111
"""<img src="%s:%s">foo</a>"""% (protocol,rest_of_uri))
112112

113113

114+
deftest_details_open_allowed():
115+
sanitized=sanitize_html("<details open>.</details>")
116+
expected='<details open>.</details>'
117+
assertexpected==sanitized
118+
119+
120+
deftest_details_summary_allowed():
121+
sanitized=sanitize_html("<details><summary>.</summary><p>...</p></details>")
122+
expected='<details><summary>.</summary><p>...</p></details>'
123+
assertexpected==sanitized
124+
125+
114126
@pytest.mark.parametrize("expected, input",
115127
(pytest.param(expected,input,id=id)
116128
forid,expected,inputinparam_sanitizer()))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp