From e020c623ac6fb1a230475026e7b884c897fce662 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Mon, 20 Jun 2011 08:46:39 -0400 Subject: 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. --- markdown/searializers.py | 7 +++++-- 1 file 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 -- cgit v1.2.3