EPUB
EPUB, short for electronic publication, is a widely used eBook file format that allows digital books to be read on various devices like eReaders, tablets, and smartphones. It supports re-flowable text, multimedia elements, and is compatible with many reading applications.
EPUB is structured using XML and XHTML. There are scripts that allow one to convert Asciidoc to EPUB.
Calibre: Editing table of contents
- Launch Calibre.
- Add the EPUB to your library
- Select the book, hit T to open the EPUB editor. You'll likely find that the file is split into HTML files that don't correspond to the Chapter headings. In the case of my book, the chapter headings were:
<span class="calibre7">Chapter 1</span> - Select the HTML file and right-click, choose "Split at multiple locations".
- Use the dialog box to generate an XPath expression, in this case
//h:span[re:test(@class, "calibre7", "i")]. - In my case, one chapter was split across two files. Select both files, right-click, and choose the Merge option.
- Click the "Edit Table of Contents" button, and choose "Generate ToC from files".
- Save the book.
- Upload the new EPUB in place of the old one.
Note
These days, I use Sigil on my Mac instead of Calibre's editor. The process is similar.