X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/11d863057b43462248572daed7c8fc698d573b3d..45aed036278c98bda04414dfd6f216bc5d2f7586:/librarian/pyhtml.py diff --git a/librarian/pyhtml.py b/librarian/pyhtml.py index f358178..e5ca40e 100644 --- a/librarian/pyhtml.py +++ b/librarian/pyhtml.py @@ -42,9 +42,9 @@ class EduModule(Xmill): self.activity_counter += 1 self.options = { 'activity': True, - 'activity_counter': self.activity_counter + 'activity_counter': self.activity_counter, } - submill = EduModule(self.options) + submill = EduModule(dict(self.options.items() + {'sub_gen': True}.items())) opis = submill.generate(element.xpath('opis')[0]) @@ -78,10 +78,10 @@ class EduModule(Xmill): """ % locals() - handle_opis = ifoption(activity=False)(tag('div', 'description')) - handle_wskazowki = ifoption(activity=False)(tag('div', ('hints', 'teacher'))) + handle_opis = ifoption(sub_gen=True)(tag('div', 'description')) + handle_wskazowki = ifoption(sub_gen=True)(tag('div', ('hints', 'teacher'))) - @ifoption(activity=False) + @ifoption(sub_gen=True) @tagged('div', 'materials') def handle_pomoce(self, _): return "Pomoce: ", "" @@ -302,7 +302,8 @@ Overrides the returned content default handle_pytanie class Luki(Exercise): def find_pieces(self, question): - return question.xpath("//luka") + print question.xpath(".//luka") + return question.xpath(".//luka") def solution_html(self, piece): return piece.text + ''.join( @@ -325,8 +326,7 @@ class Luki(Exercise): return qpre, qpost def handle_opis(self, element): - pre, post = super(Luki, self).handle_opis(element) - return pre, self.words_html + post + return '', self.words_html def handle_luka(self, element): self.piece_counter += 1 @@ -335,7 +335,7 @@ class Luki(Exercise): class Zastap(Luki): def find_pieces(self, question): - return question.xpath("//zastap") + return question.xpath(".//zastap") def solution_html(self, piece): return piece.attrib['rozw']