Mercurial > genshi > genshi-test
diff markup/output.py @ 105:334a338847af
Include processing instructions in serialized streams.
author | cmlenz |
---|---|
date | Fri, 28 Jul 2006 15:15:50 +0000 |
parents | 35d681a94763 |
children | 2de3f9d84a1c |
line wrap: on
line diff
--- a/markup/output.py +++ b/markup/output.py @@ -22,7 +22,7 @@ from itertools import chain from markup.core import escape, Markup, Namespace, QName -from markup.core import DOCTYPE, START, END, START_NS, END_NS, TEXT, COMMENT +from markup.core import DOCTYPE, START, END, START_NS, END_NS, TEXT, COMMENT, PI __all__ = ['Serializer', 'XMLSerializer', 'HTMLSerializer'] @@ -154,6 +154,9 @@ elif kind is COMMENT: yield Markup('<!--%s-->' % data) + elif kind is PI: + yield Markup('<?%s %s?>' % data) + class XHTMLSerializer(XMLSerializer): """Produces XHTML text from an event stream. @@ -238,6 +241,9 @@ elif kind is COMMENT: yield Markup('<!--%s-->' % data) + elif kind is PI: + yield Markup('<?%s %s?>' % data) + class HTMLSerializer(XHTMLSerializer): """Produces HTML text from an event stream. @@ -308,6 +314,9 @@ elif kind is COMMENT: yield Markup('<!--%s-->' % data) + elif kind is PI: + yield Markup('<?%s %s?>' % data) + class _PushbackIterator(object): """A simple wrapper for iterators that allows pushing items back on the