File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
[tool .poetry ]
2
2
name = " simple-html"
3
- version = " 1.1.0 "
3
+ version = " 1.1.1 "
4
4
readme = " README.md"
5
5
description = " Template-less html rendering in Python"
6
6
authors = [
" Keith Philpott <[email protected] >" ]
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ def __hash__(self) -> int:
80
80
81
81
def escape_attribute_key (k : str ) -> str :
82
82
return (
83
- escape (k )
83
+ escape (k , True )
84
84
.replace ("=" , "=" )
85
85
.replace ("\\ " , "\" )
86
86
.replace ("`" , "`" )
@@ -121,7 +121,7 @@ def __call__(
121
121
else escape_attribute_key (key )
122
122
)
123
123
if isinstance (val , str ):
124
- attrs += f' { key } ="{ escape (val )} "'
124
+ attrs += f' { key } ="{ escape (val , True )} "'
125
125
elif isinstance (val , SafeString ):
126
126
attrs += f' { key } ="{ val .safe_str } "'
127
127
elif val is None :
Original file line number Diff line number Diff line change @@ -186,8 +186,8 @@ def test_render_with_escaped_attributes() -> None:
186
186
== '<div onmousenter="alert(1)" noop="1"></div>'
187
187
)
188
188
assert (
189
- render (span ({"<script></script>" : ">" }))
190
- == '<span <script></script>=">"></span>'
189
+ render (span ({"<script>\" </script>" : " \ " >" }))
190
+ == '<span <script>"& lt;/script>="" >"></span>'
191
191
)
192
192
# vals and keys escape slightly differently
193
193
assert (
You can’t perform that action at this time.
0 commit comments