Don't show activity counter if it's not adjacent to another activity
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Fri, 30 Aug 2013 14:58:03 +0000 (16:58 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Fri, 30 Aug 2013 14:58:03 +0000 (16:58 +0200)
librarian/pyhtml.py

index 096e1f6..7816a40 100644 (file)
@@ -28,6 +28,7 @@ class EduModule(Xmill):
     def __init__(self, options=None):
         super(EduModule, self).__init__(options)
         self.activity_counter = 0
     def __init__(self, options=None):
         super(EduModule, self).__init__(options)
         self.activity_counter = 0
+        self.activity_last = None
         self.exercise_counter = 0
 
         # text filters
         self.exercise_counter = 0
 
         # text filters
@@ -113,10 +114,17 @@ class EduModule(Xmill):
 
         counter = self.activity_counter
 
 
         counter = self.activity_counter
 
+        if element.getnext().tag == 'aktywnosc' or self.activity_last.getnext() == element:
+            counter_html = """<span class="act_counter">%(counter)d.</span>""" % locals()
+        else:
+            counter_html = ''
+
+        self.activity_last = element
+
         return u"""
 <div class="activity">
  <div class="text">
         return u"""
 <div class="activity">
  <div class="text">
-  <span class="act_counter">%(counter)d.</span>
+  %(counter_html)s
   %(opis)s""" % locals(), \
 u"""%(wskazowki)s
  </div>
   %(opis)s""" % locals(), \
 u"""%(wskazowki)s
  </div>