From: Aleksander Ɓukasz Date: Mon, 2 Sep 2013 11:12:07 +0000 (+0200) Subject: Don't show activity counter if it's not adjacent to another activity (PDF) X-Git-Url: https://git.mdrn.pl/librarian.git/commitdiff_plain/b90a579e68c18d9fea2170fe38b61d44b8e1d4c3?ds=inline Don't show activity counter if it's not adjacent to another activity (PDF) Introduces e7471348f9839fec053b6ccbf3c6c8a2b06fe8aa to PDF generator. --- diff --git a/librarian/pypdf.py b/librarian/pypdf.py index 0793951..59b2cc4 100644 --- a/librarian/pypdf.py +++ b/librarian/pypdf.py @@ -69,6 +69,7 @@ class EduModule(Xmill): def __init__(self, options=None, state=None): super(EduModule, self).__init__(options, state) self.activity_counter = 0 + self.activity_last = None self.exercise_counter = 0 def swap_endlines(txt): @@ -248,9 +249,16 @@ class EduModule(Xmill): counter = self.activity_counter + if element.getnext().tag == 'aktywnosc' or self.activity_last.getnext() == element: + counter_tex = """%(counter)d.""" % locals() + else: + counter_tex = '' + + self.activity_last = element + return u""" -%(counter)d. +%(counter_tex)s %(czas)s %(forma)s