X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/5c55be51e46b296d368b86375f2f4b90ea46c00b..cf84f2cb13d4d761d3bfb639d99bc3700b188c49:/librarian/epub.py diff --git a/librarian/epub.py b/librarian/epub.py index f34bb86..bbeb3d7 100644 --- a/librarian/epub.py +++ b/librarian/epub.py @@ -368,6 +368,10 @@ def transform(wldoc, verbose=False, for flag in flags: document.edoc.getroot().set(flag, 'yes') + # add editors info + document.edoc.getroot().set('editors', u', '.join(sorted( + editor.readable() for editor in document.editors()))) + opf = xslt(document.book_info.to_etree(), get_resource('epub/xsltContent.xsl')) manifest = opf.find('.//' + OPFNS('manifest')) guide = opf.find('.//' + OPFNS('guide')) @@ -471,7 +475,10 @@ def transform(wldoc, verbose=False, if not flags or not 'without-fonts' in flags: # strip fonts tmpdir = mkdtemp('-librarian-epub') - cwd = os.getcwd() + try: + cwd = os.getcwd() + except OSError: + cwd = None 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': @@ -486,7 +493,8 @@ def transform(wldoc, verbose=False, manifest.append(etree.fromstring( '' % (fname, fname))) rmtree(tmpdir) - os.chdir(cwd) + if cwd is not None: + os.chdir(cwd) zip.writestr('OPS/content.opf', etree.tostring(opf, pretty_print=True)) title = document.book_info.title