Check out my first novel, midnight's simulacra!

EPUB: Difference between revisions

From dankwiki
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 3: Line 3:
==Contents==
==Contents==
* There must be a file <tt>mimetype</tt> in the toplevel containing the string <tt>application/epub+zip</tt>
* There must be a file <tt>mimetype</tt> in the toplevel containing the string <tt>application/epub+zip</tt>
* There must be a directory <tt>META-INF</tt> in the toplevel
* There must be a directory <tt>META-INF</tt> in the toplevel containing:
** <tt>container.xml</tt> specifies one or more ''rootfiles'', using their locations relative to the toplevel:
<pre>
<?xml version="1.0"?>
<container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0">
<rootfiles>
  <rootfile full-path="PATHPATHPATH" media-type="application/oebps-package+xml"/>
</rootfiles>
</container>
</pre>
 
==EPUB-specific markup==
Ensure you've referenced <tt>xmlns:epub="http://www.idpf.org/2007/ops</tt> in your <tt>html</tt> tag.
 
When using reflowable EPUB, there's no real concept of a page, and thus no real concept of footnotes. One can move them to the end of a chapter, but an arguably better solution is a popup. Enclose the footnote text in an <tt>aside</tt> tag ala:
<syntaxhighlight lang="html">
<aside hidden="hidden" epub:type="footnote" id="SOMEID">
<div class="footnote"><a href="#CALLSITE">*</a> Footnote text.</div>
</aside>
</syntaxhighlight>
Use of <tt>epub:type="footnote"</tt> ought result in the text being hidden, but you might need <tt>hidden="hidden"</tt> in your <tt>aside</tt> tag. Unfortunately, this latter causes problems with the popup text in Calibre (at least version 7.4).
Wrap the callsite with an <tt>a</tt> tag:
<syntaxhighlight lang="html">
<a role="doc-noteref" epub:type="noteref" href="#SOMEID" id>Callsite text.</a>
</syntaxhighlight>
Without <tt>role="doc-noteref"</tt>, you will not get a popup in Calibre.
===Entities===
EPUB3 eliminates all but a few HTML entitites.
* &amp;nbsp; ↦ &amp;#160;
 
==See also==
* [https://kindlegen.s3.amazonaws.com/AmazonKindlePublishingGuidelines.pdf Kindle Publishing Guidelines] from Amazon

Latest revision as of 04:56, 7 February 2024

EPUB (in version 3.3 as of 2023-12-21) is a container for ebooks using ZIP for its archive and compression. Most of the content is XHTML or media (usually graphics).

Contents

  • There must be a file mimetype in the toplevel containing the string application/epub+zip
  • There must be a directory META-INF in the toplevel containing:
    • container.xml specifies one or more rootfiles, using their locations relative to the toplevel:
<?xml version="1.0"?>
<container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0">
 <rootfiles>
  <rootfile full-path="PATHPATHPATH" media-type="application/oebps-package+xml"/>
 </rootfiles>
</container>

EPUB-specific markup

Ensure you've referenced xmlns:epub="http://www.idpf.org/2007/ops in your html tag.

When using reflowable EPUB, there's no real concept of a page, and thus no real concept of footnotes. One can move them to the end of a chapter, but an arguably better solution is a popup. Enclose the footnote text in an aside tag ala:

<aside hidden="hidden" epub:type="footnote" id="SOMEID">
 <div class="footnote"><a href="#CALLSITE">*</a> Footnote text.</div>
</aside>

Use of epub:type="footnote" ought result in the text being hidden, but you might need hidden="hidden" in your aside tag. Unfortunately, this latter causes problems with the popup text in Calibre (at least version 7.4). Wrap the callsite with an a tag:

<a role="doc-noteref" epub:type="noteref" href="#SOMEID" id>Callsite text.</a>

Without role="doc-noteref", you will not get a popup in Calibre.

Entities

EPUB3 eliminates all but a few HTML entitites.

  • &nbsp; ↦ &#160;

See also