Mercurial > genshi > genshi-test
diff markup/core.py @ 96:35d681a94763
Add an XHTML serialization method. Now really need to get rid of some code duplication in the `markup.output` module.
author | cmlenz |
---|---|
date | Fri, 21 Jul 2006 11:39:32 +0000 |
parents | e82d1bb07464 |
children | 5e9987f34e6c |
line wrap: on
line diff
--- a/markup/core.py +++ b/markup/core.py @@ -68,7 +68,8 @@ """Return a string representation of the stream. @param method: determines how the stream is serialized; can be either - 'xml' or 'html', or a custom `Serializer` subclass + "xml", "xhtml", or "html", or a custom `Serializer` + subclass @param encoding: how the output string should be encoded; if set to `None`, this method returns a `unicode` object @@ -99,7 +100,8 @@ string. @param method: determines how the stream is serialized; can be either - 'xml' or 'html', or a custom `Serializer` subclass + "xml", "xhtml", or "html", or a custom `Serializer` + subclass @param filters: list of filters to apply to the stream before serialization. The default is to apply whitespace reduction using `markup.filters.WhitespaceFilter`. @@ -108,8 +110,9 @@ from markup import output cls = method if isinstance(method, basestring): - cls = {'xml': output.XMLSerializer, - 'html': output.HTMLSerializer}[method] + cls = {'xml': output.XMLSerializer, + 'xhtml': output.XHTMLSerializer, + 'html': output.HTMLSerializer}[method] else: assert issubclass(cls, output.Serializer) serializer = cls(**kwargs)