From ac6f4dfb3c4e7ac8b22ab56390e61634a8152df6 Mon Sep 17 00:00:00 2001
From: Radek Czajka
Date: Tue, 8 Oct 2013 12:04:25 +0200
Subject: [PATCH] Add thank-you note in EPUB and PDF.
---
librarian/dcparser.py | 1 +
librarian/epub.py | 2 ++
librarian/epub/xsltTitle.xsl | 4 ++++
librarian/pdf.py | 2 ++
librarian/pdf/wl.cls | 5 +++++
librarian/pdf/wl2tex.xslt | 5 +++++
6 files changed, 19 insertions(+)
diff --git a/librarian/dcparser.py b/librarian/dcparser.py
index abee11b..a907a52 100644
--- a/librarian/dcparser.py
+++ b/librarian/dcparser.py
@@ -173,6 +173,7 @@ class WorkInfo(object):
as_person, salias='technical_editor', multiple=True, default=[]),
Field( DCNS('contributor.funding'), 'funders',
salias='funder', multiple=True, default=[]),
+ Field( DCNS('contributor.thanks'), 'thanks', required=False),
Field( DCNS('date'), 'created_at', as_date),
Field( DCNS('date.pd'), 'released_to_public_domain_at', as_date, required=False),
diff --git a/librarian/epub.py b/librarian/epub.py
index f211ee4..bfd7570 100644
--- a/librarian/epub.py
+++ b/librarian/epub.py
@@ -418,6 +418,8 @@ def transform(wldoc, verbose=False,
if document.book_info.funders:
document.edoc.getroot().set('funders', u', '.join(
document.book_info.funders))
+ if document.book_info.thanks:
+ document.edoc.getroot().set('thanks', document.book_info.thanks)
opf = xslt(document.book_info.to_etree(), get_resource('epub/xsltContent.xsl'))
manifest = opf.find('.//' + OPFNS('manifest'))
diff --git a/librarian/epub/xsltTitle.xsl b/librarian/epub/xsltTitle.xsl
index 17739a8..9544e27 100644
--- a/librarian/epub/xsltTitle.xsl
+++ b/librarian/epub/xsltTitle.xsl
@@ -52,6 +52,10 @@
+
+ .
+
+
Utwór opracowany zostaÅ w ramach projektu Wolne Lektury przez fundacjÄ Nowoczesna Polska.
diff --git a/librarian/pdf.py b/librarian/pdf.py
index 90e4dc2..b4edfdb 100644
--- a/librarian/pdf.py
+++ b/librarian/pdf.py
@@ -233,6 +233,8 @@ def transform(wldoc, verbose=False, save_tex=None, morefloats=None,
editor.readable() for editor in document.editors())))
if document.book_info.funders:
root.set('funders', u', '.join(document.book_info.funders))
+ if document.book_info.thanks:
+ root.set('thanks', document.book_info.thanks)
# hack the tree
move_motifs_inside(document.edoc)
diff --git a/librarian/pdf/wl.cls b/librarian/pdf/wl.cls
index 0de767c..a9ace8e 100644
--- a/librarian/pdf/wl.cls
+++ b/librarian/pdf/wl.cls
@@ -215,6 +215,11 @@ Letters={SmallCaps,UppercaseSmallCaps}
\vspace{.5em}
\fi
+ \ifdefined\thanknote
+ \thanknote
+ \vspace{.5em}
+ \fi
+
Utwór opracowany zostaŠw ramach projektu \href{http://www.wolnelektury.pl/}{Wolne Lektury}
przez \href{http://nowoczesnapolska.org.pl}{fundacjÄ Nowoczesna Polska}.
diff --git a/librarian/pdf/wl2tex.xslt b/librarian/pdf/wl2tex.xslt
index 353ecf9..ca948da 100644
--- a/librarian/pdf/wl2tex.xslt
+++ b/librarian/pdf/wl2tex.xslt
@@ -64,6 +64,11 @@
210mm
+
+
+ \def\thanknote{}
+
+
--
2.20.1