From 6b75d94412c089b10bd7637b1008bdaf9057a440 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Mon, 14 Mar 2016 17:51:28 +0100 Subject: [PATCH] images in PDF --- librarian/pdf.py | 5 ++++- librarian/pdf/wl.cls | 5 +++++ librarian/pdf/wl2tex.xslt | 6 ++++++ librarian/xslt/book2html.xslt | 18 ++++++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) 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 @@
+ + + + + + + + + + + + + + + + + + -- 2.20.1