+ html_tree, method="html", pretty_print=True))
+
+ nav_map.append(etree.fromstring(
+ '<navPoint id="NavPoint-%(i)d" playOrder="%(i)d" ><navLabel><text>Strona redakcyjna</text>'\
+ '</navLabel><content src="last.html" /></navPoint>' % {'i': toc_counter}))
+ manifest.append(etree.fromstring(
+ '<item id="last" href="last.html" media-type="application/xhtml+xml" />'))
+ spine.append(etree.fromstring(
+ '<itemref idref="last" />'))
+ stopka = input_xml.find('//stopka')
+ if stopka is not None:
+ stopka.tag = 'stopka_'
+ replace_by_verse(stopka)
+ html_tree = xslt(stopka, get_resource('epub/xsltScheme.xsl'))
+ else:
+ html_tree = xslt(input_xml, get_resource('epub/xsltLast.xsl'))
+ chars.update(used_chars(html_tree.getroot()))
+ zip.writestr('OPS/last.html', etree.tostring(
+ html_tree, method="html", pretty_print=True))
+
+ # strip fonts
+ tmpdir = mkdtemp('-librarian-epub')
+ cwd = os.getcwd()
+
+ os.chdir(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'font-optimizer'))
+ for fname in 'DejaVuSerif.ttf', 'DejaVuSerif-Bold.ttf', 'DejaVuSerif-Italic.ttf', 'DejaVuSerif-BoldItalic.ttf':
+ optimizer_call = ['perl', 'subset.pl', '--chars', ''.join(chars).encode('utf-8'),
+ get_resource('fonts/' + fname), os.path.join(tmpdir, fname)]
+ if verbose:
+ print "Running font-optimizer"
+ subprocess.check_call(optimizer_call)
+ else:
+ subprocess.check_call(optimizer_call, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ zip.write(os.path.join(tmpdir, fname), os.path.join('OPS', fname))
+ rmtree(tmpdir)
+ os.chdir(cwd)