From deca3e31b94bc7ec95d47c309ff560a097337e97 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 18 Dec 2020 10:22:34 +0100 Subject: [PATCH] EPUB: Support for subchapters without chapters. --- src/librarian/epub.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/librarian/epub.py b/src/librarian/epub.py index c286903..35766b8 100644 --- a/src/librarian/epub.py +++ b/src/librarian/epub.py @@ -327,6 +327,18 @@ def transform_chunk(chunk_xml, chunk_no, annotations, empty=False, ) ) elif element.tag in ('naglowek_podrozdzial', 'naglowek_scena'): + if not toc: + toc.append( + ( + epub.Link( + "part%d.xhtml" % chunk_no, + " ", + "part%d" % chunk_no + ), + [] + ) + ) + subnumber = len(toc[-1][1]) toc[-1][1].append( epub.Link( -- 2.20.1