diff markup/core.py @ 96:fa08aef181a2 trunk

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 a71a58df6bf5
children a519f581a1b1
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)
Copyright (C) 2012-2017 Edgewall Software