X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/f03d1fdbe472dbfb103d00b0e4ee9fa593c7b2c0..1ef7c1807a866e5d8fb99238499be4ea240dceae:/librarian/pyhtml.py
diff --git a/librarian/pyhtml.py b/librarian/pyhtml.py
index a46659c..3bda4c8 100644
--- a/librarian/pyhtml.py
+++ b/librarian/pyhtml.py
@@ -4,84 +4,164 @@
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from lxml import etree
-from librarian import OutputFile, RDFNS, DCNS
-from xmlutils import Xmill, tag, tagged, ifoption
+from librarian import IOFile, Format
+from xmlutils import Xmill, tag, tagged, ifoption, tag_open_close
+from librarian import functions
import re
import random
+from copy import deepcopy
+
+IMAGE_THUMB_WIDTH = 300
+
class EduModule(Xmill):
- def __init__(self, *args):
- super(EduModule, self).__init__(*args)
+ def __init__(self, options=None):
+ super(EduModule, self).__init__(options)
self.activity_counter = 0
+ self.activity_last = None
+ self.exercise_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_escaped_text_filter(swap_endlines)
+
+ @tagged('div', 'stanza')
+ def handle_strofa(self, element):
+ self.options = {'strofa': True}
+ return "", ""
def handle_powiesc(self, element):
return u"""
%s
%s min
Czas: %(czas)s min
-Forma: %(forma)s
- %(pomoce)s -W przygotowaniu.
' + else: + return None if ltype == 'slowniczek': - self.options = {'slowniczek': True} - return '