X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/79da3449684beeb938735346e1d66093f51ba36d..36ded31bc121ec258d35bd209d9da93224f773aa:/librarian/pyhtml.py diff --git a/librarian/pyhtml.py b/librarian/pyhtml.py index bd3bbce..621340e 100644 --- a/librarian/pyhtml.py +++ b/librarian/pyhtml.py @@ -142,11 +142,11 @@ class Excercise(EduModule): self.question_counter = 0 self.piece_counter = 0 - return u""" + pre = u"""
-""" % element.attrib, \ -u""" +""" % element.attrib + post = u"""
@@ -155,8 +155,16 @@ u"""
""" + # Add a single tag if it's not there + if not element.xpath(".//pytanie"): + qpre, qpost = self.handle_pytanie(element) + pre = pre + qpre + post = qpost + post + return pre, post def handle_pytanie(self, element): + """This will handle element, when there is no + """ self.question_counter += 1 self.piece_counter = 0 solution = element.attrib.get('rozw', None) @@ -186,15 +194,17 @@ class Wybor(Excercise): class Uporzadkuj(Excercise): - def handle_cwiczenie(self, element): - pre, post = super(Uporzadkuj, self).handle_cwiczenie(element) + def handle_pytanie(self, element): + """ +Overrides the returned content default handle_pytanie + """ + # we ignore the result, returning our own + super(Uporzadkuj, self).handle_pytanie(element) order_items = element.xpath(".//punkt/@rozw") - import pdb - if order_items == []: pdb.set_trace() - return pre + u"""
""" % \ - ','.join(order_items), \ - u"""
""" + post + return u"""
""" % \ + (','.join(order_items), self.question_counter), \ + u"""
""" def handle_punkt(self, element): return """
  • """ \