X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/a14ba61c2bdad8d7dd6262e3afec8ba8f6a47416..e0e7693096469f5952eef1c5847dabc9cf797f70:/librarian/pyhtml.py?ds=sidebyside diff --git a/librarian/pyhtml.py b/librarian/pyhtml.py index f362715..fcfb3a6 100644 --- a/librarian/pyhtml.py +++ b/librarian/pyhtml.py @@ -14,6 +14,7 @@ class EduModule(Xmill): self.activity_counter = 0 + # def handle_utwor(self, element): # v = {} # # from pdb import *; set_trace() @@ -113,7 +114,9 @@ class EduModule(Xmill): def handle_cwiczenie(self, element): excercise_handlers = { 'wybor': Wybor, - 'uporzadkuj': Uporzadkuj + 'uporzadkuj': Uporzadkuj, + 'luki': Luki, + 'zastap': Zastap, } typ = element.attrib['typ'] @@ -121,7 +124,7 @@ class EduModule(Xmill): return handler.generate(element) # Lists - def handle_lista(self, element): + def handle_lista(self, element, attrs={}): ltype = element.attrib.get('typ', 'punkt') if ltype == 'slowniczek': self.options = {'slowniczek': True} @@ -132,7 +135,13 @@ class EduModule(Xmill): 'alfa': 'ul', 'czytelnia': 'ul'}[ltype] - return '<%s class="lista %s">' % (listtag, ltype), '%s>' % listtag + classes = attrs.get('class', '') + if classes: del attrs['class'] + + attrs_s = ' '.join(['%s="%s"' % kv for kv in attrs.items()]) + if attrs_s: attrs_s = ' ' + attrs_s + + return '<%s class="lista %s %s"%s>' % (listtag, ltype, classes, attrs_s), '%s>' % listtag def handle_punkt(self, element): if self.options['slowniczek']: @@ -187,10 +196,12 @@ class Wybor(Excercise): qc = self.question_counter self.piece_counter += 1 no = self.piece_counter - + eid = "q%(qc)d_%(no)d" % locals() return u""" -