From: Jan Szejko Date: Wed, 25 Jan 2017 12:20:33 +0000 (+0100) Subject: description (sponsor info) in lesson pdf X-Git-Url: https://git.mdrn.pl/librarian.git/commitdiff_plain/5175c4cb9704f442c20abffbd575fb588278b3b2?hp=05a4485b020b9252f5ffc02d19c163705cbf26e2 description (sponsor info) in lesson pdf --- diff --git a/librarian/pdf.py b/librarian/pdf.py index 2f5c209..c02e98c 100644 --- a/librarian/pdf.py +++ b/librarian/pdf.py @@ -81,7 +81,7 @@ def fix_hanging(doc): insert_tags(doc, re.compile("(?<=\s\w)\s+"), "nbsp", - exclude=[DCNS("identifier.url"), DCNS("rights.license")] + exclude=[DCNS("identifier.url"), DCNS("rights.license"), DCNS("title"), DCNS("description")] ) diff --git a/librarian/pypdf.py b/librarian/pypdf.py index 408b18d..aa4dc1d 100644 --- a/librarian/pypdf.py +++ b/librarian/pypdf.py @@ -29,7 +29,7 @@ def escape(really): def _wrap(*args, **kw): value = f(*args, **kw) - prefix = (u'' % (really and 1 or 0)) + prefix = (u'' % (1 if really else 0)) postfix = u'' if isinstance(value, list): import pdb @@ -108,10 +108,14 @@ class EduModule(Xmill): authors = getattr(dc, "authors_%s" % which) return u', '.join(author.readable() for author in authors if author) - @escape(1) + @escape(True) def get_title(self, element): return self.get_dc(element, 'title', True) + @escape(True) + def get_description(self, element): + return self.get_dc(element, 'description', single=True) + def handle_utwor(self, element): lines = [ u''' @@ -130,6 +134,7 @@ class EduModule(Xmill): u'''\\def\\authorsexpert{%s}''' % self.get_authors(element, 'expert'), u'''\\def\\authorsscenario{%s}''' % self.get_authors(element, 'scenario'), u'''\\def\\authorstextbook{%s}''' % self.get_authors(element, 'textbook'), + u'''\\def\\description{%s}''' % self.get_description(element), u'''\\author{\\authors}''', u'''\\title{%s}''' % self.get_title(element), @@ -140,14 +145,14 @@ class EduModule(Xmill): return u"".join(filter(None, lines)), u'' - @escape(1) + @escape(True) def handle_powiesc(self, element): return u""" """, """""" - @escape(1) + @escape(True) def handle_texcommand(self, element): cmd = functions.texcommand(element.tag) return u'' % cmd, u'' @@ -386,11 +391,11 @@ class EduModule(Xmill): tabular%s ''' % ('l' * max_col), u'''tabular''' - @escape(1) + @escape(True) def handle_wiersz(self, element): return u"", u'' - @escape(1) + @escape(True) def handle_kol(self, element): if element.getnext() is not None: return u"", u'' diff --git a/librarian/res/styles/edumed/pdf/edumed.sty b/librarian/res/styles/edumed/pdf/edumed.sty index b25a99d..dc856d1 100644 --- a/librarian/res/styles/edumed/pdf/edumed.sty +++ b/librarian/res/styles/edumed/pdf/edumed.sty @@ -68,6 +68,9 @@ Materiał pochodzi z serwisu \href{http://edukacjamedialna.edu.pl}{edukacjamedia \vspace{.6em} Źródło: \href{\bookurl}{\bookurl}. +\vspace{.6em} +\description + \color{black} } \end{figure}