Difference between revisions of "Input and compilation/EPUB"
Jump to navigation
Jump to search
| Line 1: | Line 1: | ||
{{todo|This page is work in progress and an update to the current pages [[Input and compilation/EPUB/OLD Epub]] and [[Input and compilation/EPUB/OLD Epub Sample]].}} | {{todo|This page is work in progress and an update to the current pages [[Input and compilation/EPUB/OLD Epub]] and [[Input and compilation/EPUB/OLD Epub Sample]].}} | ||
| − | < [[Input_and_compilation/XML source|XML]] | [[Export]] | [[Input and compilation/EPUB/OLD Epub|Old ePub docs]] | [[Input and compilation/EPUB/OLD Epub Sample|Old ePub Sample]] > | + | < [[Input_and_compilation/XML source|XML]] | [[Input_and_compilation/Export|Export]] | [[Input and compilation/EPUB/OLD Epub|Old ePub docs]] | [[Input and compilation/EPUB/OLD Epub Sample|Old ePub Sample]] > |
| − | The ePub facilities of ConTeXt are based on its [[Export]] of XML/XHTML. Make sure you get useful export output from your project before you try ePub. | + | The ePub facilities of ConTeXt are based on its [[Input_and_compilation/Export|Export]] of XML/XHTML. Make sure you get useful export output from your project before you try ePub. |
= Documentation about ePub = | = Documentation about ePub = | ||
| Line 14: | Line 14: | ||
= Minimal ePub = | = Minimal ePub = | ||
| − | If you already ran ConTeXt on your project and got the file structure as described in [[Export]], you can run {{code|1=mtxrun --script epub --make minimal}} to get a structure like: | + | If you already ran ConTeXt on your project and got the file structure as described in [[Input_and_compilation/Export|Export]], you can run {{code|1=mtxrun --script epub --make minimal}} to get a structure like: |
<pre> | <pre> | ||
Latest revision as of 10:44, 12 January 2025
| TODO: This page is work in progress and an update to the current pages Input and compilation/EPUB/OLD Epub and Input and compilation/EPUB/OLD Epub Sample. (See: To-Do List) |
< XML | Export | Old ePub docs | Old ePub Sample >
The ePub facilities of ConTeXt are based on its Export of XML/XHTML. Make sure you get useful export output from your project before you try ePub.
Documentation about ePub
- Wikipedia entry with some examples
- Open Packaging Format (OPF) 2.0.1 specs; contains also information about NCX
- ePub3 ISO/IEC TS 30135-1:2014 (Buy specs for 118 CHF?)
- ePub Check validator (most validation tools are based on this)
Minimal ePub
If you already ran ConTeXt on your project and got the file structure as described in Export, you can run mtxrun --script epub --make minimal to get a structure like:
minimal.epub minimal-epub ├── META-INF │ └── container.xml ├── OEBPS │ ├── cover.xhtml │ ├── images │ ├── minimal-div.html │ ├── minimal.opf │ ├── nav.xhtml │ ├── styles │ │ ├── minimal-defaults.css │ │ ├── minimal-fonts.css │ │ ├── minimal-images.css │ │ └── minimal-styles.css │ └── toc.ncx └── mimetype
- .epub: The epub file is just a zipped version of the directory structure.
- mimetype: contains only "
application/epub+zip" - container.xml points to the root file "minimal.opf"
- cover.xhtml is the cover image shown by ePub readers
- -div.html: your content
- .opf: list of all resources, this keeps the "book" together. See also OPF specs.
- .ncx: table of contents
Compressing the structure
The file structure outlined above gets packaged into a ZIP archive with the .epub extension.
- mimetype must be the first directory entry of the archive.
- You must not use "extra file attributes", e.g. from MacOS (AKA resource forks) or NTFS; use the X parameter of zip.
- You don’t want some other lurking files like MacOS’s .DS_Store directory information or PDF images; exclude them from recursive packaging.
EPUB=minimal.epub zip -u9X $EPUB mimetype zip -u9X $EPUB META-INF/container.xml zip -u9rX $EPUB OEBPS -x OEBPS/.DS_Store OEBPS/Text/.DS_Store OEBPS/Images/.DS_Store "*/.DS_Store" "OEBPS/Images/*.pdf"
TODO
Write about
- Cover
- ToC
- Readers
- Styling
- Images
- Better workflow