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])
</div>
""" % 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: ", ""
surl = element.attrib.get('href', None)
sxml = None
if surl:
- sxml = etree.fromstring(self.provider.by_uri(surl).get_string())
+ sxml = etree.fromstring(self.options['provider'].by_uri(surl).get_string())
self.options = {'slowniczek': True, 'slowniczek_xml': sxml }
return '<div class="slowniczek">', '</div>'
# let's pull definiens from another document
if self.options['slowniczek_xml'] and (not nxt or nxt.tag != 'definiens'):
sxml = self.options['slowniczek_xml']
- defloc = sxml.xpath("//definiendum[content()='%s']" % element.text)
+ assert element.text != ''
+ defloc = sxml.xpath("//definiendum[text()='%s']" % element.text)
if defloc:
- definiens = defloc.getnext()
+ definiens = defloc[0].getnext()
if definiens.tag == 'definiens':
subgen = EduModule(self.options)
definiens_s = subgen.generate(definiens)
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(
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
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']