Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
2b5614ca
Commit
2b5614ca
authored
Jul 05, 2013
by
Christian Heimes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #18347: ElementTree's html serializer now preserves the case of closing tags.
parent
2cb2b1ad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
Lib/test/test_xml_etree.py
Lib/test/test_xml_etree.py
+7
-0
Lib/xml/etree/ElementTree.py
Lib/xml/etree/ElementTree.py
+3
-3
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_xml_etree.py
View file @
2b5614ca
...
...
@@ -751,6 +751,13 @@ class ElementTreeTest(unittest.TestCase):
'<html><link><script>1 < 2</script></html>
\
n
'
)
self
.
assertEqual
(
serialize
(
e
,
method
=
"text"
),
'1 < 2
\
n
'
)
def
test_issue18347
(
self
):
e
=
ET
.
XML
(
'<html><CamelCase>text</CamelCase></html>'
)
self
.
assertEqual
(
serialize
(
e
),
'<html><CamelCase>text</CamelCase></html>'
)
self
.
assertEqual
(
serialize
(
e
,
method
=
"html"
),
'<html><CamelCase>text</CamelCase></html>'
)
def
test_entity
(
self
):
# Test entity handling.
...
...
Lib/xml/etree/ElementTree.py
View file @
2b5614ca
...
...
@@ -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
()
l
tag
=
tag
.
lower
()
if
text
:
if
tag
==
"script"
or
tag
==
"style"
:
if
ltag
==
"script"
or
l
tag
==
"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
l
tag
not
in
HTML_EMPTY
:
write
(
"</"
+
tag
+
">"
)
if
elem
.
tail
:
write
(
_escape_cdata
(
elem
.
tail
))
...
...
Misc/NEWS
View file @
2b5614ca
...
...
@@ -41,6 +41,9 @@ Core and Builtins
Library
-------
- Issue #18347: ElementTree'
s
html
serializer
now
preserves
the
case
of
closing
tags
.
-
Issue
#
17261
:
Ensure
multiprocessing
's proxies use proper address.
- Issue #18343: faulthandler.register() now keeps the previous signal handler
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment