+
+class Uporzadkuj(Excercise):
+ 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")
+
+ return u"""<div class="question" data-original="%s" data-no="%s">""" % \
+ (','.join(order_items), self.question_counter), \
+ u"""</div>"""
+
+ def handle_punkt(self, element):
+ return """<li class="question-piece" data-pos="%(rozw)s"/>""" \
+ % element.attrib,\
+ "</li>"
+
+
+class Luki(Excercise):
+ def handle_luka(self, element):
+ return '<input type="text" class="luka question-piece" data-solution="%s"></input>' % element.text
+
+
+class Zastap(Excercise):
+ def handle_zastap(self, element):
+ return '<span class="zastap question-piece" data-solution="%(rozw)s">' % element.attrib, '</span>'
+
+
+class Przyporzadkuj(Excercise):
+ def handle_lista(self, lista):
+ print "in lista %s %s" % (lista.attrib, self.options)
+ if 'nazwa' in lista.attrib:
+ attrs = {
+ 'data-name': lista.attrib['nazwa'],
+ 'class': 'predicate'
+ }
+ self.options = {'predicate': True}
+ elif 'cel' in lista.attrib:
+ attrs = {
+ 'data-target': lista.attrib['cel'],
+ 'class': 'subject'
+ }
+ self.options = {'subject': True}
+ else:
+ attrs = {}
+ pre, post = super(Przyporzadkuj, self).handle_lista(lista, attrs)
+ return pre, post + '<br class="clr"/>'
+
+ def handle_punkt(self, element):
+ print "in punkt %s %s" % (element.attrib, self.options)
+
+ if self.options['subject']:
+ return '<li data-solution="%(rozw)s" class="question-piece draggable">' % element.attrib, '</li>'
+ elif self.options['predicate']:
+ return '<li data-predicate="%(nazwa)s">' % element.attrib, '<ul class="subjects droppable"></ul></li>'
+ else:
+ return super(Przyporzadkuj, self).handle_punkt(element)