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

Commit01b7dea

Browse files
twmambv
andauthored
Add support for <ol reversed>, related attributes (html5lib#396)
* Mark <ol reversed> as a boolean attribute so it serializes properly in HTML.* Allow <ol reversed> in the sanitizer.Closeshtml5lib#321.* Allow <ol start> in the sanitizer.* <ol type> was already allowed, but probably accidentally (type is an attribute allowed for other tags). I added a test to prevent it from regressing in case we add per-element attribute sanitization in the future.https://html.spec.whatwg.org/multipage/grouping-content.html#attr-ol-reversedCo-authored-by: Łukasz Langa <lukasz@langa.pl>
1 parent82047b0 commit01b7dea

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

‎CHANGES.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ Features:
1111
* Add support for the ``<wbr>`` element in the sanitizer, `which indicates
1212
a line break opportunity <https://html.spec.whatwg.org/#the-wbr-element>`_.
1313
This element is allowed by default. (#395) (Thank you, Tom Most!)
14+
* Add support for serializing the ``<ol reversed>`` boolean attribute. (Thank
15+
you, Tom Most!) (#396)
16+
* The ``<ol reversed>`` and ``<ol start>`` attributes are now permitted by the
17+
sanitizer. (#321) (Thank you, Tom Most!)
1418

1519
Bug fixes:
1620

17-
* The sanitizer now permits ``<summary>`` tags.
21+
* The sanitizer now permits ``<summary>`` tags. It used to allow ``<details>``
22+
already. (#423)
1823

1924
1.1
2025
~~~

‎html5lib/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@
617617
"button":frozenset(["disabled","autofocus"]),
618618
"input":frozenset(["disabled","readonly","required","autofocus","checked","ismap"]),
619619
"select":frozenset(["disabled","readonly","autofocus","multiple"]),
620+
"ol":frozenset(["reversed"]),
620621
"output":frozenset(["disabled","readonly"]),
621622
"iframe":frozenset(["seamless"]),
622623
}

‎html5lib/filters/sanitizer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@
365365
(None,'maxsize'),
366366
(None,'minsize'),
367367
(None,'other'),
368+
(None,'reversed'),
368369
(None,'rowalign'),
369370
(None,'rowalign'),
370371
(None,'rowalign'),
@@ -375,6 +376,7 @@
375376
(None,'scriptlevel'),
376377
(None,'selection'),
377378
(None,'separator'),
379+
(None,'start'),
378380
(None,'stretchy'),
379381
(None,'width'),
380382
(None,'width'),

‎html5lib/tests/test_sanitizer.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,21 @@ def test_uppercase_color_codes_in_style():
154154
sanitized=sanitize_html("<p style=\"border: 1px solid #A2A2A2;\"></p>")
155155
expected='<p style=\"border: 1px solid #A2A2A2;\"></p>'
156156
assertexpected==sanitized
157+
158+
159+
deftest_ol_start_allowed():
160+
sanitized=sanitize_html("<ol start=2><li>.</ol>")
161+
expected='<ol start="2"><li>.</li></ol>'
162+
assertexpected==sanitized
163+
164+
165+
deftest_ol_type_allowed():
166+
sanitized=sanitize_html("<ol type=I><li>.</ol>")
167+
expected='<ol type="I"><li>.</li></ol>'
168+
assertexpected==sanitized
169+
170+
171+
deftest_ol_reversed_allowed():
172+
sanitized=sanitize_html("<ol reversed><li>.</ol>")
173+
expected='<ol reversed><li>.</li></ol>'
174+
assertexpected==sanitized

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp