X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/83cae63af4330912cdb2546c195af2919afd30ac..8495b2ce8e9aebe778db74217b60fb68c0b5f9f2:/src/librarian/pdf.py diff --git a/src/librarian/pdf.py b/src/librarian/pdf.py index cad66a4..31dfe1e 100644 --- a/src/librarian/pdf.py +++ b/src/librarian/pdf.py @@ -284,6 +284,14 @@ def transform(wldoc, verbose=False, save_tex=None, morefloats=None, elif package_available('morefloats', 'maxfloats=19'): root.set('morefloats', 'new') + if customizations is None: + customizations = [] + else: + customizations = list(customizations) + + if book_info.endnotes: + customizations.append('endnotes') + # add customizations if customizations is not None: root.set('customizations', u','.join(customizations)) @@ -306,6 +314,7 @@ def transform(wldoc, verbose=False, save_tex=None, morefloats=None, fix_hanging(document.edoc) fix_tables(document.edoc) mark_subauthors(document.edoc) + document.fix_pa_akap() # wl -> TeXML style_filename = get_stylesheet("wl2tex") @@ -320,8 +329,8 @@ def transform(wldoc, verbose=False, save_tex=None, morefloats=None, base_url, ilustr.get('src') ) - with six.moves.urllib.request.urlopen(url) as imgfile: - img = Image.open(imgfile) + imgfile = six.moves.urllib.request.urlopen(url) + img = Image.open(imgfile) th_format, ext, media_type = { 'GIF': ('GIF', 'gif', 'image/gif'), @@ -338,6 +347,8 @@ def transform(wldoc, verbose=False, save_tex=None, morefloats=None, th.save(os.path.join(temp, file_name)) ilustr.set('src', file_name) + imgfile.close() + for sponsor in book_info.sponsors: ins = etree.Element("data-sponsor", name=sponsor) logo = sponsor_logo(sponsor)