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('<a name="sec[0-9]*"/>', '', etree.tostring(result))
+ return re.sub('</?blockquote[^>]*>', '', html)
+
+
def transform(wldoc, stylesheet='legacy', options=None, flags=None):
"""Transforms the WL document to XHTML.
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