From: Radek Czajka Date: Mon, 24 Jan 2011 15:25:31 +0000 (+0100) Subject: fix for empty editors X-Git-Tag: 1.7~215 X-Git-Url: https://git.mdrn.pl/librarian.git/commitdiff_plain/5c8b83a904d5dd988c0bfd86729b91a1ac763164?ds=sidebyside;hp=0fd2ed230ea6d53adb5e627731672c996485167b fix for empty editors --- 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