From: Radek Czajka Date: Fri, 18 Dec 2020 09:22:34 +0000 (+0100) Subject: EPUB: Support for subchapters without chapters. X-Git-Tag: 1.11.2~1 X-Git-Url: https://git.mdrn.pl/librarian.git/commitdiff_plain/deca3e31b94bc7ec95d47c309ff560a097337e97?ds=sidebyside EPUB: Support for subchapters without chapters. --- 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(