aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2011-06-20 08:46:39 -0400
committerWaylan Limberg <waylan@gmail.com>2011-06-20 08:46:39 -0400
commite020c623ac6fb1a230475026e7b884c897fce662 (patch)
tree738646f6cefc4817d1bc536dd5a654cff11bcb52
parentd19e49dd9a6b9ff4f2668c38857fb67ce926e951 (diff)
downloadmarkdown-e020c623ac6fb1a230475026e7b884c897fce662.tar.gz
markdown-e020c623ac6fb1a230475026e7b884c897fce662.tar.bz2
markdown-e020c623ac6fb1a230475026e7b884c897fce662.zip
Updated searializers to handle boolean attributes. html gets the value only and xhtml gets the key=value pair. We didn't need this prior to adding the attr_list ext.
-rw-r--r--markdown/searializers.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/markdown/searializers.py b/markdown/searializers.py
index 39dcb56..16f178c 100644
--- a/markdown/searializers.py
+++ b/markdown/searializers.py
@@ -156,8 +156,11 @@ def _serialize_html(write, elem, encoding, qnames, namespaces, format):
v = qnames[v.text]
else:
v = _escape_attrib_html(v, encoding)
- # FIXME: handle boolean attributes
- write(" %s=\"%s\"" % (qnames[k], v))
+ if qnames[k] == v and format == 'html':
+ # handle boolean attributes
+ write(" %s" % v)
+ else:
+ write(" %s=\"%s\"" % (qnames[k], v))
if namespaces:
items = namespaces.items()
items.sort(key=lambda x: x[1]) # sort on prefix