2,849 bytes added
, 17:02, 18 May 2011
ConTeXt has preliminary [http://en.wikipedia.org/wiki/EPUB epub] support starting from '''current 2011.05.18'''.
In order to make an epub (archive) from your ConTeXt source files, you need to:
# enable the export backend in your <code>.tex</code> file or environment file (see [[Project structure]])
# call the appropriate <code>mtxrun</code> command (with the epub script) shown in the output of a context run or in the log file
'''Note:''' There is no support for graphics yet, that will be included in a later version.
== Export ==
To enable the export backend, depending on your needs, one of the following lines has to be included at the beginning of the document (before <cmd>starttext</cmd>).
<texcode>
\setupbackend[export=yes]
\setupbackend[export=yes,xhtml=yes]
\setupbackend[export=yes,xhtml=whatever.xhtml]
\setupbackend[export=yes,css={whatever.css,somemore.css}]
</texcode>
The backend can export into:
* xml
* xhtml
* xhtml+css
''For making an epub, you need an xhtml export.''
== cld-mkvi ==
It is also possible to hook css into the output, see thread: [http://www.ntg.nl/pipermail/ntg-context/2011/058907.html ntg-context].
Example:
<texcode>
\setupbackend
[export=cld-mkiv-export.xml,
xhtml=cld-mkiv-export.xhtml,
css={cld-mkiv-export.css,mathml.css}]
</texcode>
== Mtxrun ==
The actual generation of the epub can be triggered with the <code>mtxrun</code> command shown in the output.
Example log entry:
...
backend > export > saving xml data in 'oeps.export
backend > export > saving css template in 'oeps.template
backend > export > saving xhtml variant in 'oeps.xhtml
backend > export > saving specification in 'oeps.specification' (mtxrun --script epub --make oeps.specification)
...
The "oeps" will be replaced with the appropriate name given to the export backend.
Therefore, execute:
mtxrun --script epub --make oeps.specification
This will create an ''oeps.tree'' folder with an ''oeps.epub'' inside it.
More on this on the mailing list, thread starts at: [http://www.ntg.nl/pipermail/ntg-context/2011/058996.html ntg-context].
== Example ==
<texcode>
\setupbackend[export=yes,xhtml=test.xhtml]
\starttext
Hello world!
\stoptext
</texcode>
== Tools ==
Viewer:
* [http://calibre-ebook.com/ calibre]
* [http://www.epubread.com/ EPUBReader for Firefox]
* [http://www.fbreader.org/ FBReader]
Validation:
* [http://code.google.com/p/epubcheck/ EpubCheck]
* [http://www.amazon.com/gp/feature.html?docId=1000234621 KindleGen]
Specification:
* [http://idpf.org/epub epub]
== Current Issues ==
As of 19:00, 18 May 2011 (CEST):
<table>
<tr style="background:#cccccc;">
<td>tool</td>
<td>description</td>
<td>error</td>
</tr>
<tr>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>
</table>