X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/51b9dc0babf62ea90091eeb5bafec66e39aab910..b416c7d130f17ac3191d2ef39492cd7c4f70bef7:/librarian/epub.py diff --git a/librarian/epub.py b/librarian/epub.py index f2987b5..70403fd 100644 --- a/librarian/epub.py +++ b/librarian/epub.py @@ -84,13 +84,14 @@ def replace_characters(node): .replace(",,", u"\u201E")\ .replace('"', u"\u201D")\ .replace("'", u"\u2019") - if node.tag == 'extra': + if node.tag in ('uwaga', 'extra'): + t = node.tail node.clear() - else: - node.text = replace_chars(node.text) - node.tail = replace_chars(node.tail) - for child in node: - replace_characters(child) + node.tail = t + node.text = replace_chars(node.text) + node.tail = replace_chars(node.tail) + for child in node: + replace_characters(child) def find_annotations(annotations, source, part_no): @@ -106,7 +107,7 @@ def find_annotations(annotations, source, part_no): child.clear() child.tail = tail child.text = number - if child.tag not in ('extra',): + if child.tag not in ('extra', 'uwaga'): find_annotations(annotations, child, part_no) @@ -396,6 +397,7 @@ def transform(provider, slug=None, file_path=None, output_file=None, output_dir= '') zip.write(get_resource('epub/style.css'), os.path.join('OPS', 'style.css')) zip.write(get_resource('res/wl-logo-small.png'), os.path.join('OPS', 'logo_wolnelektury.png')) + zip.write(get_resource('res/jedenprocent.png'), os.path.join('OPS', 'jedenprocent.png')) opf = xslt(metadata, get_resource('epub/xsltContent.xsl')) manifest = opf.find('.//' + OPFNS('manifest'))