X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/40110cdb916b003da032cb350fad27bd22f64602..dcb79a51be0506180dd6e70765f20a15470818d6:/librarian/epub.py diff --git a/librarian/epub.py b/librarian/epub.py index 397dc51..7fd6daf 100644 --- a/librarian/epub.py +++ b/librarian/epub.py @@ -201,10 +201,10 @@ class Stanza(object): if not text: return for i, verse_text in enumerate(re.split(r"/\s*\n", text)): - if not verse_text.strip(): - continue if i: self.open_normal_verse() + if not verse_text.strip(): + continue verse = self.get_open_verse() if len(verse): verse[-1].tail = (verse[-1].tail or "") + verse_text @@ -462,6 +462,7 @@ def transform(wldoc, verbose=False, style=None, html_toc=False, doctype='' ) + html_string = re.sub(ur'([^\r])\n', ur'\1\r\n', html_string) zip.writestr('OPS/part%d.html' % chunk_counter, html_string) add_to_manifest(manifest, chunk_counter) add_to_spine(spine, chunk_counter) @@ -675,12 +676,13 @@ def transform(wldoc, verbose=False, style=None, html_toc=False, ''.join(chars).encode('utf-8'), get_resource('fonts/' + fname), os.path.join(tmpdir, fname)] + env = {"PERL_USE_UNSAFE_INC": "1"} if verbose: print "Running font-optimizer" - subprocess.check_call(optimizer_call) + subprocess.check_call(optimizer_call, env=env) else: dev_null = open(os.devnull, 'w') - subprocess.check_call(optimizer_call, stdout=dev_null, stderr=dev_null) + subprocess.check_call(optimizer_call, stdout=dev_null, stderr=dev_null, env=env) zip.write(os.path.join(tmpdir, fname), os.path.join('OPS', fname)) manifest.append(etree.fromstring( '' % (fname, fname)))