X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/515398ba21b6ac3c0db230a465cfc8528db8d10e..e7471348f9839fec053b6ccbf3c6c8a2b06fe8aa:/librarian/pyhtml.py?ds=sidebyside
diff --git a/librarian/pyhtml.py b/librarian/pyhtml.py
index 1f1f3df..7816a40 100644
--- a/librarian/pyhtml.py
+++ b/librarian/pyhtml.py
@@ -28,6 +28,7 @@ class EduModule(Xmill):
def __init__(self, options=None):
super(EduModule, self).__init__(options)
self.activity_counter = 0
+ self.activity_last = None
self.exercise_counter = 0
# text filters
@@ -36,7 +37,7 @@ class EduModule(Xmill):
txt = txt.replace("/\n", "
\n")
return txt
self.register_text_filter(functions.substitute_entities)
- self.register_text_filter(swap_endlines)
+ self.register_escaped_text_filter(swap_endlines)
@tagged('div', 'stanza')
def handle_strofa(self, element):
@@ -93,7 +94,10 @@ class EduModule(Xmill):
}
submill = EduModule(dict(self.options.items() + {'sub_gen': True}.items()))
- opis = submill.generate(element.xpath('opis')[0])
+ if element.xpath('opis'):
+ opis = submill.generate(element.xpath('opis')[0])
+ else:
+ opis = ''
n = element.xpath('wskazowki')
if n: wskazowki = submill.generate(n[0])
@@ -110,10 +114,17 @@ class EduModule(Xmill):
counter = self.activity_counter
+ if element.getnext().tag == 'aktywnosc' or self.activity_last.getnext() == element:
+ counter_html = """%(counter)d.""" % locals()
+ else:
+ counter_html = ''
+
+ self.activity_last = element
+
return u"""