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 11[tool .poetry ]
22name = " simple-html"
3- version = " 1.1.0 "
3+ version = " 1.1.1 "
44readme = " README.md"
55description = " Template-less html rendering in Python"
66authors = [" Keith Philpott <fakekeith@example.org>" ]
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ def __hash__(self) -> int:
8080
8181def escape_attribute_key (k : str ) -> str :
8282 return (
83- escape (k )
83+ escape (k , True )
8484 .replace ("=" , "=" )
8585 .replace ("\\ " , "\" )
8686 .replace ("`" , "`" )
@@ -121,7 +121,7 @@ def __call__(
121121 else escape_attribute_key (key )
122122 )
123123 if isinstance (val , str ):
124- attrs += f' { key } ="{ escape (val )} "'
124+ attrs += f' { key } ="{ escape (val , True )} "'
125125 elif isinstance (val , SafeString ):
126126 attrs += f' { key } ="{ val .safe_str } "'
127127 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:
186186 == '<div onmousenter="alert(1)" noop="1"></div>'
187187 )
188188 assert (
189- render (span ({"<script></script>" : ">" }))
190- == '<span <script></script>=">"></span>'
189+ render (span ({"<script>\" </script>" : " \ " >" }))
190+ == '<span <script>"& lt;/script>="" >"></span>'
191191 )
192192 # vals and keys escape slightly differently
193193 assert (
You can’t perform that action at this time.
0 commit comments