mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #18347: ElementTree's html serializer now preserves the case of closing tags.
This commit is contained in:
parent
be9c841494
commit
54ad7e39df
3 changed files with 13 additions and 3 deletions
|
@ -1039,15 +1039,15 @@ def _serialize_html(write, elem, qnames, namespaces):
|
|||
# FIXME: handle boolean attributes
|
||||
write(" %s=\"%s\"" % (qnames[k], v))
|
||||
write(">")
|
||||
tag = tag.lower()
|
||||
ltag = tag.lower()
|
||||
if text:
|
||||
if tag == "script" or tag == "style":
|
||||
if ltag == "script" or ltag == "style":
|
||||
write(text)
|
||||
else:
|
||||
write(_escape_cdata(text))
|
||||
for e in elem:
|
||||
_serialize_html(write, e, qnames, None)
|
||||
if tag not in HTML_EMPTY:
|
||||
if ltag not in HTML_EMPTY:
|
||||
write("</" + tag + ">")
|
||||
if elem.tail:
|
||||
write(_escape_cdata(elem.tail))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue