Changes

Jump to navigation Jump to search
2,000 bytes added ,  13:24, 9 August 2020
m
Text replacement - "</cmd>" to "}}"
{{todo|Beware, this doesn’t fit the current state of export files as of January 2015!}} < [[Export]] | [[ePub|New ePub docs]] > == Minimal example == A minimal example file would be: <texcode>\setupbackend[export=yes,xhtml=yes] \mainlanguage[de]\language[de] \setupexport [title={A nice book}, author={John Doe}, firstpage={huhn.jpg}, ] \starttextHello world!\stoptext</texcode> Please note, that a cover image is part of a valid epub file, therefore you should provide one even in the most minimal case. It is called huhn.jpg in this case. Make sure it is in the same directory as you tex file. Now you have to call the script to produce the epub <texcode>mtxrun --script epub --make test_00.specification</texcode> assuming that the minimal example tex file is called test_00.tex == More information == ConTeXt has preliminary [http://en.wikipedia.org/wiki/EPUB epub] support starting from [[Context 2011.05.18 | current 2011.05.18]].Some problems were fixed end of August 2014, don’t use an older version!
'''Note:''' There is no support for graphics yet, that will be included in a later version.
 
'''There’s also a more extensive [[Epub Sample|example]].'''
== 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]
''For making an epub, you need an xhtml export.''
 
If you are unsure, which one of the three backend options you should use, use the minimal one:
 
<texcode>
\setupbackend[export=yes,xhtml=yes]
</texcode>
When using a css file, images are supported using an extra css file <code>*-images.css</code>. Images with suffix <code>pdf</code> are remapped to <code>svg</code> but <code>png</code> and <code>jpg</code> are passed on.
<texcode>
\settaggedmetadatasetupexport [title=My Document{A nice book}, author=By Me{John Doe}, version firstpage=1{huhn.0jpg}, ]
</texcode>
 
You are free to choose keys. Metadata is flushed as child of the next element.
== The example file ==
It is You can also possible to hook css into the output, see thread: [http://www.ntg.nl/pipermail/ntg-context/2011/058907.html ntg-context]. The distribution has a test file <code>export-example.tex</code>. This file exports conforming:
<texcode>
<texcode>
mtxrun --script epub --make export-example
</texcode>
....
\stopchapter
</texcode>
 
In this case the data will be injected just after the start of the chapter tag. So, if you want to have document level metadata, you need to put the set command before {{cmd|starttext}}.
 
== Document styling ==
Some style elements are exported to an additional css file and a reference to that file is automatically added. You can exercise some control over the general document rendering:
 
<texcode>
\setupexport
[bodyfont=12pt,
width=600pt,
%align=flushleft,
hyphen=yes]
</texcode>
In this case The last option makes sure that the data will be injected just after the start export has enough information to do a reasonable hyohenation. Future versions of the chapter tag. So, if you want to have document level metadata, you need to put the set command before <cmd>starttext</cmd>exported might provide some more control.
== Mtxrun ==
More on this on the mailing list, thread starts at: [http://www.ntg.nl/pipermail/ntg-context/2011/058996.html ntg-context].
 
== Minimal Example ==
 
<texcode>
\setupbackend[export=yes,xhtml=test.xhtml]
\starttext
Hello world!
\stoptext
</texcode>
== Tools ==
</tr>
</table>
 
== Latest news ==
 
(This section is to be integrated in the instructions above.)
 
Now
<texcode>
\setupbackend
[export=yes,
xhtml=yes,
css=export-example.css]
</texcode>
also exports an html file with all tags being 'div' and the default css has been adapted to support both. The default css still need some work because not all browsers handle these div expressions equally well. The idea is to have a decent looking default as template (one can always overload).
 
--Hans 27 August 2014
 
The problem with an invalid export.xml when using project structure is also fixed since 27 August 2014.

Navigation menu