Epub: fixes #4164, #4166 1.15
authorRadek Czajka <rczajka@rczajka.pl>
Tue, 2 Mar 2021 13:10:44 +0000 (14:10 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Tue, 2 Mar 2021 13:10:44 +0000 (14:10 +0100)
CHANGELOG.md
setup.py
src/librarian/epub.py

index 4efa62a..f441e50 100644 (file)
@@ -3,6 +3,14 @@
 This document records all notable changes to Librarian.
 
 
+## 1.15 (2021-03-02)
+
+### Fixed
+- Epub: translator marked with MARC Relators role 'trl'.
+- Epub: authors and translators dc:creator elements had duplicate `id`.
+- Epub: 'Start' element in TOC was added inconsistently and in wrong order.
+
+
 ## 1.14 (2021-02-05)
 
 ### Changed
index 5b6f487..c02c054 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@ def whole_tree(prefix, path):
 
 setup(
     name='librarian',
-    version='1.14',
+    version='1.15',
     description='Converter from WolneLektury.pl XML-based language to XHTML, TXT and other formats',
     author="Marek Stępniowski",
     author_email='marek@stepniowski.com',
index 5a88d5a..e2cdae7 100644 (file)
@@ -448,6 +448,14 @@ def transform(wldoc, verbose=False, style=None,
             output.add_item(item)
             spine.append(item)
 
+            toc[-1][1].append(
+                epub.Link(
+                    "part1.xhtml",
+                    "Początek utworu",
+                    "part1"
+                )
+            )
+
         elif wldoc.book_info.parts:
             # write title page for every parent
             if sample is not None and sample <= 0:
@@ -541,16 +549,18 @@ def transform(wldoc, verbose=False, style=None,
     output.set_identifier(six.text_type(document.book_info.url))
     output.set_language(functions.lang_code_3to2(document.book_info.language))
     output.set_title(document.book_info.title)
-    for author in document.book_info.authors:
+    for i, author in enumerate(document.book_info.authors):
         output.add_author(
             author.readable(),
-            file_as=six.text_type(author)
+            file_as=six.text_type(author),
+            uid='creator{}'.format(i)
         )
     for translator in document.book_info.translators:
         output.add_author(
             translator.readable(),
             file_as=six.text_type(translator),
-            role='translator'
+            role='trl',
+            uid='translator{}'.format(i)
         )
     for publisher in document.book_info.publisher:
         output.add_metadata("DC", "publisher", publisher)
@@ -670,15 +680,6 @@ def transform(wldoc, verbose=False, style=None,
     toc, chunk_counter, chars, sample = transform_file(document, sample=sample)
     output.toc = toc[0][1]
 
-    if len(toc) < 2:
-        output.toc.append(
-            epub.Link(
-                "part1.xhtml",
-                "Początek utworu",
-                "part1"
-            )
-        )
-
     # Last modifications in container files and EPUB creation
     if len(annotations) > 0:
         output.toc.append(