From 5c8b83a904d5dd988c0bfd86729b91a1ac763164 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 24 Jan 2011 16:25:31 +0100 Subject: [PATCH 1/1] fix for empty editors --- librarian/epub/xsltLast.xsl | 4 ++-- librarian/pdf.py | 2 ++ librarian/text.py | 3 ++- tests/files/text/asnyk_miedzy_nami.xml | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/librarian/epub/xsltLast.xsl b/librarian/epub/xsltLast.xsl index 0739606..92f5be6 100644 --- a/librarian/epub/xsltLast.xsl +++ b/librarian/epub/xsltLast.xsl @@ -78,10 +78,10 @@ - +

Opracowanie redakcyjne i przypisy: - + , diff --git a/librarian/pdf.py b/librarian/pdf.py index 41de1b3..5f28547 100644 --- a/librarian/pdf.py +++ b/librarian/pdf.py @@ -132,6 +132,8 @@ def parse_creator(doc): for person in doc.xpath("|".join('//dc:'+(tag) for tag in ( 'creator', 'contributor.translator', 'contributor.editor', 'contributor.technical_editor')), namespaces = {'dc': str(DCNS)})[::-1]: + if not person.text: + continue p = Person.from_text(person.text) person_parsed = deepcopy(person) person_parsed.tag = person.tag + '_parsed' diff --git a/librarian/text.py b/librarian/text.py index bcb031d..f5aafc1 100644 --- a/librarian/text.py +++ b/librarian/text.py @@ -55,7 +55,8 @@ def transform(input_file, output_file, parse_dublincore=True, **options): else: source = '' - contributors = ', '.join(person.readable() for person in sorted(set(parsed_dc.technical_editors + parsed_dc.editors))) + contributors = ', '.join(person.readable() for person in + sorted(set(p for p in (parsed_dc.technical_editors + parsed_dc.editors) if p))) if contributors: contributors = "\n\nOpracowanie redakcyjne i przypisy: %s" % contributors else: diff --git a/tests/files/text/asnyk_miedzy_nami.xml b/tests/files/text/asnyk_miedzy_nami.xml index d7ab4fc..36d8df6 100644 --- a/tests/files/text/asnyk_miedzy_nami.xml +++ b/tests/files/text/asnyk_miedzy_nami.xml @@ -6,6 +6,7 @@ Asnyk, Adam Między nami nic nie było + Sekuła, Aleksandra Sutkowska, Olga Fundacja Nowoczesna Polska -- 2.20.1