aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/serializers.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2013-08-07 21:39:08 -0400
committerWaylan Limberg <waylan@gmail.com>2013-08-07 21:39:08 -0400
commita64592d5f288d0b83b11aa7d4eade728d5d5fb91 (patch)
treed14e2849cf2ca93b9a0bf813fa0f75644af2b3f8 /markdown/serializers.py
parenta4ceb0b2a5f2c2ae8aa3981182cf829fdd28e840 (diff)
downloadmarkdown-a64592d5f288d0b83b11aa7d4eade728d5d5fb91.tar.gz
markdown-a64592d5f288d0b83b11aa7d4eade728d5d5fb91.tar.bz2
markdown-a64592d5f288d0b83b11aa7d4eade728d5d5fb91.zip
Serializers now preserve case of tags.
It is up to the markdown code (and extension authors to make sure tags are of the correct case (there may be cases were an extension might need to mix cases - which should be preserved). Fixes #237. Thanks for the report @eichin.
Diffstat (limited to 'markdown/serializers.py')
-rw-r--r--markdown/serializers.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/markdown/serializers.py b/markdown/serializers.py
index b19d61c..0c4ebcb 100644
--- a/markdown/serializers.py
+++ b/markdown/serializers.py
@@ -172,19 +172,18 @@ def _serialize_html(write, elem, qnames, namespaces, format):
if k:
k = ":" + k
write(" xmlns%s=\"%s\"" % (k, _escape_attrib(v)))
- if format == "xhtml" and tag in HTML_EMPTY:
+ if format == "xhtml" and tag.lower() in HTML_EMPTY:
write(" />")
else:
write(">")
- tag = tag.lower()
if text:
- if tag == "script" or tag == "style":
+ if tag.lower() in ["script", "style"]:
write(text)
else:
write(_escape_cdata(text))
for e in elem:
_serialize_html(write, e, qnames, None, format)
- if tag not in HTML_EMPTY:
+ if tag.lower() not in HTML_EMPTY:
write("</" + tag + ">")
if elem.tail:
write(_escape_cdata(elem.tail))