X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/8a57745b13b2875fcf6441b06171a1fd762c51ee..6a4cff9d955a0dbf417f684bf98a288f089bf46b:/librarian/html.py?ds=inline diff --git a/librarian/html.py b/librarian/html.py index defb84c..a566f71 100644 --- a/librarian/html.py +++ b/librarian/html.py @@ -32,6 +32,17 @@ def html_has_content(text): return etree.ETXPath('//p|//{%(ns)s}p|//h1|//{%(ns)s}h1' % {'ns': str(XHTMLNS)})(text) +def transform_abstrakt(abstrakt_element): + from cStringIO import StringIO + style_filename = get_stylesheet('legacy') + style = etree.parse(style_filename) + xml = etree.tostring(abstrakt_element) + document = etree.parse(StringIO(xml.replace('abstrakt', 'dlugi_cytat'))) # HACK + result = document.xslt(style) + html = re.sub('', '', etree.tostring(result)) + return re.sub(']*>', '', html) + + def transform(wldoc, stylesheet='legacy', options=None, flags=None): """Transforms the WL document to XHTML.