mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-14 05:15:12 -05:00
17 lines
490 B
Python
17 lines
490 B
Python
from __future__ import absolute_import, division, unicode_literals
|
|
|
|
from .. import treewalkers
|
|
|
|
from .htmlserializer import HTMLSerializer
|
|
|
|
|
|
def serialize(input, tree="etree", format="html", encoding=None,
|
|
**serializer_opts):
|
|
# XXX: Should we cache this?
|
|
walker = treewalkers.getTreeWalker(tree)
|
|
if format == "html":
|
|
s = HTMLSerializer(**serializer_opts)
|
|
else:
|
|
raise ValueError("type must be html")
|
|
return s.render(walker(input), encoding)
|