X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/3c4a248abd2c5cc1d84447403608119cfc9e0cd1..22290f82670463d15f15f42cf1fe3ead76a6c08e:/librarian/pyhtml.py diff --git a/librarian/pyhtml.py b/librarian/pyhtml.py index 9264c15..16a2141 100644 --- a/librarian/pyhtml.py +++ b/librarian/pyhtml.py @@ -4,7 +4,7 @@ # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from lxml import etree -from librarian import IOFile, RDFNS, DCNS, Format +from librarian import IOFile, Format from xmlutils import Xmill, tag, tagged, ifoption, tag_open_close from librarian import functions import re @@ -13,6 +13,7 @@ from copy import deepcopy IMAGE_THUMB_WIDTH = 300 + class EduModule(Xmill): def __init__(self, options=None): super(EduModule, self).__init__(options) @@ -99,13 +100,16 @@ class EduModule(Xmill): opis = '' n = element.xpath('wskazowki') - if n: wskazowki = submill.generate(n[0]) - - else: wskazowki = '' + if n: + wskazowki = submill.generate(n[0]) + else: + wskazowki = '' n = element.xpath('pomoce') - if n: pomoce = submill.generate(n[0]) - else: pomoce = '' + if n: + pomoce = submill.generate(n[0]) + else: + pomoce = '' forma = ''.join(element.xpath('forma/text()')) get_forma_url = self.options['urlmapper'].get_forma_url @@ -127,28 +131,29 @@ class EduModule(Xmill): counter = self.activity_counter - if element.getnext().tag == 'aktywnosc' or self.activity_last.getnext() == element: - counter_html = """%(counter)d.""" % locals() + if element.getnext().tag == 'aktywnosc' or (self.activity_last and self.activity_last.getnext() == element): + counter_html = """%(counter)d.""" % {'counter': counter} else: counter_html = '' self.activity_last = element - return u""" + return ( + u"""