epub:convert epub-convert
epubtools/epub-convert.xpl
Import URI: http://transpect.le-tex.de/epubtools/epub-convert.xpl
This step takes a HTML file as input and converts it to an epub file. You need a configuration for the HTML splitting and the OPF metadata. Examples can be found in the sample directory. Invoke this step on the command line with:
calabash/calabash.sh -i source=sample/b978-3-646-92351-3.xhtml
-i conf=sample/hierarchy.xml -i meta=sample/epub-config.xml epub-convert.xpl
Note that it’s advisable to make all file inputs absolute URIs, by using cygpath
on Cygwin or readlink -f
on Unixy systems. For bash, this is, e.g., source=file:/$(cygpath -ma sample/b978-3-646-92351-3.xhtml)
Input Ports
Name | Documentation | Connections |
---|---|---|
sourceⓅ | An XHTML file (Version number irrelevant; will be output as 1.1), either loaded from a physical location on disk or, alternatively, with its base URI set in an /*/@xml:base attribute. It is important that the source document have a base URI because the locations of all referenced files (CSS, images) will be determined relative to this base URI. | |
confⓈ | /hierarchy, config file for HTML splitter (see sample/hierarchy.xml). May be included in meta port doc as /epub-config/hierarchy so you don’t have to submit an extra document to this port | |
meta | /epub-config – an EPUB file’s metadata and other configuration settings (see sample/epub-config.xml for an example). Please note that the name “meta” is misleading since the file contains more than just metadata. |
Output Ports
Name | Documentation | Connections |
---|---|---|
resultⓅ | ||
chunks | ||
opf | ||
files | ||
report | ||
baseuri |
Options
Name | Documentation | Default |
---|---|---|
target | '' | |
terminate-on-error | 'yes' | |
clean-target-dir | Whether to erase the target directory prior to splitting etc. Otherwise, files from previous conversions might be included in the resulting zip file. | 'no' |
debug | 'no' | |
use-svg | '' | |
debug-dir-uri | 'debug' | |
status-dir-uri | 'status' |
Subpipeline
Step | Inputs | Outputs | Options | ||
---|---|---|---|---|---|
p:variable wrap-cover-in-svg | meta on epub-convert | ($use-svg[not(. = '')], /epub-config/cover/@svg, 'true')[1] | |||
p:variable target-format | meta on epub-convert | ($target[not(. = '')], /epub-config/@format, 'EPUB3')[1] | |||
letex:simple-progress-msg start-msg |
| result | file = 'epub-convert-start.txt' status-dir-uri = $status-dir-uri | ||
transpect:file-uri base-uri The output files are stored relative to the base-uri of the document on the primary input port. | result | filename = (base-uri(/*), static-base-uri())[1] | |||
epub:create-ocf create-ocf |
| result | base-uri = /c:result/@local-href debug = $debug debug-dir-uri = $debug-dir-uri | ||
epub:create-ops create-ops |
| result | base-uri = /c:result/@local-href target = $target-format use-svg = $wrap-cover-in-svg terminate-on-error = $terminate-on-error debug = $debug debug-dir-uri = $debug-dir-uri | ||
epub:create-opf create-opf |
| result | base-uri = /c:result/@local-href target = $target-format terminate-on-error = $terminate-on-error use-svg = $wrap-cover-in-svg debug = $debug debug-dir-uri = $debug-dir-uri | ||
p:sink d69e206 |
| ||||
p:choose | |||||
$target-format = 'EPUB2' | |||||
nav.xhtml is only carried along for creating the guide element in EPUB2 |
| match = '/*/c:file[matches(@name, 'nav\.xhtml$')]' | |||
p:otherwise | |||||
p:identity d69e229 |
| result | |||
p:sink d69e238 |
| ||||
epub:zip-package zip-package |
| result | base-uri = /c:result/@local-href debug = $debug debug-dir-uri = $debug-dir-uri | ||
letex:simple-progress-msg success-msg |
| result | file = 'epub-convert-success.txt' status-dir-uri = $status-dir-uri | ||
p:sink d69e287 |
|