Mercurial > genshi > mirror
changeset 689:3881a602048a trunk
The XHTML serializer now strips `xml:space` attributes as they are only allowed on very few tags.
author | cmlenz |
---|---|
date | Wed, 12 Mar 2008 20:48:52 +0000 |
parents | d8571da25bc5 |
children | 2298d798513e |
files | ChangeLog genshi/output.py genshi/tests/output.py |
diffstat | 3 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -49,6 +49,8 @@ * The `Stream.render` now accepts an optional `out` parameter that can be used to pass in a writable file-like object to use for assembling the output, instead of building a big string and returning it. + * The XHTML serializer now strips `xml:space` attributes as they are only + allowed on very few tags. Version 0.4.4
--- a/genshi/output.py +++ b/genshi/output.py @@ -309,6 +309,8 @@ value = attr elif attr == u'xml:lang' and u'lang' not in attrib: buf += [' lang="', escape(value), '"'] + elif attr == u'xml:space': + continue buf += [' ', attr, '="', escape(value), '"'] if kind is EMPTY: if tag in empty_elems:
--- a/genshi/tests/output.py +++ b/genshi/tests/output.py @@ -228,7 +228,7 @@ def test_xml_space(self): text = '<foo xml:space="preserve"> Do not mess \n\n with me </foo>' output = XML(text).render(XHTMLSerializer) - self.assertEqual(text, output) + self.assertEqual('<foo> Do not mess \n\n with me </foo>', output) def test_empty_script(self): text = """<html xmlns="http://www.w3.org/1999/xhtml">