X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/d887dee631335a8c44ef75250524e69e67fbc9b4..f7260ec22a6bcb39fe800ac21f335c2c903a2072:/librarian/pyhtml.py diff --git a/librarian/pyhtml.py b/librarian/pyhtml.py index d138701..b4d8557 100644 --- a/librarian/pyhtml.py +++ b/librarian/pyhtml.py @@ -9,6 +9,7 @@ from xmlutils import Xmill, tag, tagged, ifoption, tag_open_close from librarian import functions import re import random +from copy import deepcopy IMAGE_THUMB_WIDTH = 300 @@ -150,16 +151,24 @@ u"""%(wskazowki)s # Lists def handle_lista(self, element, attrs={}): ltype = element.attrib.get('typ', 'punkt') + if not element.findall("punkt"): + if ltype == 'czytelnia': + return '

W przygotowaniu.

' + else: + return None if ltype == 'slowniczek': surl = element.attrib.get('src', None) if surl is None: # print '** missing src on , setting default' - surl = 'http://edukacjamedialna.edu.pl/slowniczek' + surl = 'http://edukacjamedialna.edu.pl/lekcje/slowniczek/' sxml = None if surl: sxml = etree.fromstring(self.options['provider'].by_uri(surl).get_string()) self.options = {'slowniczek': True, 'slowniczek_xml': sxml } - return '
', '
' + pre, post = '
', '
' + if self.options['wldoc'].book_info.url.slug != 'slowniczek': + post += u'

Zobacz cały słowniczek.

' % surl + return pre, post listtag = {'num': 'ol', 'punkt': 'ul', @@ -444,12 +453,10 @@ class Luki(Exercise): return question.xpath(".//luka") def solution_html(self, piece): + piece = deepcopy(piece) + piece.tail = None 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)