we should just generate html for luki
[librarian.git] / librarian / pyhtml.py
index 88331a9..a6f6686 100644 (file)
@@ -86,8 +86,8 @@ class EduModule(Xmill):
 <div class="activity">
  <div class="text">
   <span class="act_counter">%(counter)d.</span>
-  %(opis)s
-  %(wskazowki)s
+  %(opis)s""" % locals(), \
+u"""%(wskazowki)s
  </div>
  <aside class="info">
   <section class="infobox time"><h1>Czas</h1><p>%(czas)s min</p></section>
@@ -292,14 +292,14 @@ class Wybor(Exercise):
         pre, post = super(Wybor, self).handle_cwiczenie(element)
         is_single_choice = True
         pytania = element.xpath(".//pytanie")
-        if not pytania: 
+        if not pytania:
             pytania = [element]
         for p in pytania:
             solutions = re.split(r"[, ]+", p.attrib['rozw'])
             if len(solutions) != 1:
                 is_single_choice = False
                 break
-            choices = element.xpath(".//*[@nazwa]")
+            choices = p.xpath(".//*[@nazwa]")
             uniq = set()
             for n in choices: uniq.add(n.attrib['nazwa'])
             if len(choices) != len(uniq):
@@ -357,9 +357,12 @@ class Luki(Exercise):
         return question.xpath(".//luka")
 
     def solution_html(self, piece):
-        return piece.text + ''.join(
-            [etree.tostring(n, encoding=unicode)
-             for n in piece])
+        sub = EduModule()
+        return sub.generate(piece)
+        # print piece.text
+        # return piece.text + ''.join(
+        #     [etree.tostring(n, encoding=unicode)
+        #      for n in piece])
 
     def handle_pytanie(self, element):
         qpre, qpost = super(Luki, self).handle_pytanie(element)