From 1df9b49c8a7378b1fb300c413c2c438b1d41b969 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Mon, 16 Apr 2018 10:28:07 +0200 Subject: [PATCH 1/1] book abstracts - backend --- librarian/html.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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. -- 2.20.1