From: Jan Szejko Date: Mon, 14 Mar 2016 16:51:28 +0000 (+0100) Subject: images in PDF X-Git-Tag: 1.7~77 X-Git-Url: https://git.mdrn.pl/librarian.git/commitdiff_plain/6b75d94412c089b10bd7637b1008bdaf9057a440?ds=inline;hp=fc7a8368b6033616780d563149d78db33b6b91a3 images in PDF --- diff --git a/librarian/pdf.py b/librarian/pdf.py index c899afa..246fd0c 100644 --- a/librarian/pdf.py +++ b/librarian/pdf.py @@ -199,7 +199,7 @@ def package_available(package, args='', verbose=False): def transform(wldoc, verbose=False, save_tex=None, morefloats=None, - cover=None, flags=None, customizations=None): + cover=None, flags=None, customizations=None, ilustr_path=''): """ produces a PDF file with XeLaTeX wldoc: a WLDocument @@ -268,6 +268,9 @@ def transform(wldoc, verbose=False, save_tex=None, morefloats=None, # TeXML -> LaTeX temp = mkdtemp('-wl2pdf') + for ilustr in document.edoc.findall("//ilustr"): + shutil.copy(os.path.join(ilustr_path, ilustr.get("src")), temp) + for sponsor in book_info.sponsors: ins = etree.Element("data-sponsor", name=sponsor) logo = sponsor_logo(sponsor) diff --git a/librarian/pdf/wl.cls b/librarian/pdf/wl.cls index a802e20..29683ea 100644 --- a/librarian/pdf/wl.cls +++ b/librarian/pdf/wl.cls @@ -538,3 +538,8 @@ Letters={Uppercase} \fi } +\newcommand{\ilustr}[2]{% +\vspace{1em}% +\par{\noindent\includegraphics[width=\linewidth]{#1}}% +\vspace{1em} +} diff --git a/librarian/pdf/wl2tex.xslt b/librarian/pdf/wl2tex.xslt index c278981..652a081 100644 --- a/librarian/pdf/wl2tex.xslt +++ b/librarian/pdf/wl2tex.xslt @@ -256,6 +256,12 @@ + + + + + + diff --git a/librarian/xslt/book2html.xslt b/librarian/xslt/book2html.xslt index ca7cdbd..c8aa52b 100644 --- a/librarian/xslt/book2html.xslt +++ b/librarian/xslt/book2html.xslt @@ -112,6 +112,24 @@
+ + + + + + + + + + + + + + + + + +