From: Marcin Koziej Date: Wed, 13 Feb 2013 14:43:55 +0000 (+0100) Subject: excercise counters X-Git-Url: https://git.mdrn.pl/librarian.git/commitdiff_plain/98a3fbdcedc1b8c4da602b8bb8ee304830a6de1b?ds=sidebyside excercise counters Przyporzadkuj: remove "subjects" class from ul which keeps placeholders --- diff --git a/librarian/pyhtml.py b/librarian/pyhtml.py index 313f155..f41c583 100644 --- a/librarian/pyhtml.py +++ b/librarian/pyhtml.py @@ -15,6 +15,7 @@ class EduModule(Xmill): def __init__(self, options=None): super(EduModule, self).__init__(options) self.activity_counter = 0 + self.exercise_counter = 0 # text filters def swap_endlines(txt): @@ -28,7 +29,7 @@ class EduModule(Xmill): def handle_strofa(self, element): self.options = {'strofa': True} return "", "" - + def handle_powiesc(self, element): return u"""
@@ -136,6 +137,9 @@ u"""%(wskazowki)s } typ = element.attrib['typ'] + self.exercise_counter += 1 + print self.exercise_counter + self.options = {'exercise_counter': self.exercise_counter} handler = exercise_handlers[typ](self.options) return handler.generate(element) @@ -265,7 +269,16 @@ class Exercise(EduModule): pre = u"""
-""" % element.attrib +

Zadanie %(exercies_counter)d

+
+ + + + + +
+ +""" % {'exercies_counter': self.options['exercise_counter'], 'typ': element.attrib['typ']} post = u"""
@@ -460,7 +473,7 @@ class Przyporzadkuj(Exercise): placeholders = u'
  • ' * self.options['min'] else: placeholders = u'
  • ' - return '
  • ' % element.attrib, '
      ' + placeholders + '
  • ' + return '
  • ' % element.attrib, '
      ' + placeholders + '
  • ' else: return super(Przyporzadkuj, self).handle_punkt(element)