diff options
author | Christian Heimes <christian@cheimes.de> | 2013-07-04 23:41:30 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2013-07-04 23:41:30 (GMT) |
commit | 20d46692fc95dfa4719131a3b3ce2fdaee77f280 (patch) | |
tree | 03298ecb59f665d45526665af299c6f48992127d /Lib/xml | |
parent | 0c503c2c7f788beb486c3edf8f7232bcff2f3f08 (diff) | |
download | cpython-20d46692fc95dfa4719131a3b3ce2fdaee77f280.zip cpython-20d46692fc95dfa4719131a3b3ce2fdaee77f280.tar.gz cpython-20d46692fc95dfa4719131a3b3ce2fdaee77f280.tar.bz2 |
Issue #18347: ElementTree's html serializer now preserves the case of closing tags.
Diffstat (limited to 'Lib/xml')
-rw-r--r-- | Lib/xml/etree/ElementTree.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py index bb468cd..9f3e75d 100644 --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -988,15 +988,15 @@ def _serialize_html(write, elem, encoding, 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(_encode(text, encoding)) else: write(_escape_cdata(text, encoding)) for e in elem: _serialize_html(write, e, encoding, qnames, None) - if tag not in HTML_EMPTY: + if ltag not in HTML_EMPTY: write("</" + tag + ">") if elem.tail: write(_escape_cdata(elem.tail, encoding)) |