X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/3acdb97ed96bb54a04c031e017c2059f86db57e4..0c0fdd2db2c1277108b03a1acf88ad63d140451a:/librarian/html.py?ds=sidebyside diff --git a/librarian/html.py b/librarian/html.py index 73da1b8..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. @@ -217,7 +228,7 @@ def add_anchors(root): counter = 1 for element in root.iterdescendants(): def f(e): - return e.get('class') in ('note', 'motto', 'motto_podpis', 'dedication') or \ + return e.get('class') in ('note', 'motto', 'motto_podpis', 'dedication', 'frame') or \ e.get('id') == 'nota_red' or e.tag == 'blockquote' if any_ancestor(element, f): continue