kindlegen-amzn

XProc Wrapper for Amazon's Kindlegen.

Repository
Git URL https://github.com/transpect/kindlegen-amzn.git
SVN URL https://github.com/transpect/kindlegen-amzn
Base URI http://transpect.io/kindlegen/

Source ⬇

tr:kindlegen

A XProc Wrapper for Amazon KindleGen. Pass the EPUB file and the location of your kindlegen binary as parameters to this pipeline.

java -jar calabash.jar kindlegen.xpl kindlegen=/data/mypath/kindlegen epub=/data/mypath/myepub.epub

Note: KindleGen path can be passed as option. If the option is not set, the path is resolved against a XML catalog.

Output

The MOBI file is stored to the directory of the EPUB file. The XML result shipped on the result port is either a c:file or a c:errors, depending on whether KindleGen was executed successfully.

      Success:
      <c:file code="OK" name="C:/home/my-sample.mobi"/>
      
      Warnings:
      <c:file code="warnings" name="C:/home/my-sample.mobi"/>
      
      Errors:
      <c:error tr:rule-family="kindlegen"
        name="C:/home/my-sample.epub">MOBI/KF8 generation failed!</c:error>
Requirements
  • Path normalizing requires tr:file-uri.

  • You have to download KindleGen from here and store it to some-directory

  • Paths are resolved with XSLT-based catalog resolver. You have to rewrite the URI http://this.transpect.io/infrastructure/kindlegen/i386/ with your local KindleGen install directory by using a XML catalog as it is shown in the example below:

    <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
      <nextCatalog catalog="../store-debug/xmlcatalog/catalog.xml"/>
      <nextCatalog catalog="../file-uri/xmlcatalog/catalog.xml"/>
      <nextCatalog catalog="../xslt-based-catalog-resolver/xmlcatalog/catalog.xml"/>
      
      <rewriteURI uriStartString="http://this.transpect.io/xmlcatalog/catalog.xml" rewritePrefix="my-catalog.xml"/>
      <rewriteURI uriStartString="http://this.transpect.io/infrastructure/kindlegen/i386/" rewritePrefix="../some-directory/"/>
    </catalog>
            
Known Issues
  • Consider to use cx:depends-on if your input EPUB file is dynamically generated by another XProc pipeline.

  • Running kindlegen on 64 bit Linux operating systems requires ia32-libs to be installed.

Import

<p:import href="http://transpect.io/kindlegen/xpl/kindlegen.xpl"/>

Dependencies

Synopsis

<tr:kindlegen xmlns:tr="http://transpect.io">
  <p:output port="result" primary="true"/>
  <p:output port="report" primary="false"/>
  <p:option name="kindlegen" select="''"/>
  <p:option name="epub" required="true"/>
  <p:option name="lang" select="'en'"/>
  <p:option name="ignore-warnings" select="'no'"/>
  <p:option name="debug" select="'no'"/>
  <p:option name="debug-dir-uri" select="'debug'"/>
  <p:option name="status-dir-uri" select="'status'"/>
</tr:kindlegen>

GitHub sync date: 2024-04-23+02:00