From 2919eb4f57c7e1c9dead734c685a9b36f34e30ce Mon Sep 17 00:00:00 2001 From: Marcin Koziej Date: Wed, 13 Feb 2013 14:46:25 +0100 Subject: [PATCH] endline handling in strofa --- librarian/pyhtml.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/librarian/pyhtml.py b/librarian/pyhtml.py index a6f6686..e9852a7 100644 --- a/librarian/pyhtml.py +++ b/librarian/pyhtml.py @@ -15,8 +15,20 @@ class EduModule(Xmill): def __init__(self, options=None): super(EduModule, self).__init__(options) self.activity_counter = 0 + + # text filters + def swap_endlines(txt): + if self.options['strofa']: + txt = txt.replace("/\n", "
\n") + return txt self.register_text_filter(functions.substitute_entities) + self.register_text_filter(swap_endlines) + @tagged('div', 'stanza') + def handle_strofa(self, element): + self.options = {'strofa': True} + return "", "" + def handle_powiesc(self, element): return u"""
@@ -34,7 +46,7 @@ class EduModule(Xmill): handle_naglowek_scena = tag('h2') handle_naglowek_osoba = handle_naglowek_podrozdzial = tag('h3') handle_akap = handle_akap_dialog = handle_akap_cd = tag('p', 'paragraph') - handle_strofa = tag('div', 'stanza') + handle_wyroznienie = tag('em') handle_tytul_dziela = tag('em', 'title') handle_slowo_obce = tag('em', 'foreign') -- 2.20.1