Generating EPUB 3 for ReSpec based W3C TR documents

The goal of this service is to get an HTML document in ReSpec, or an HTML document generated by ReSpec or Bikeshed, and generate an EPUB 3 file for off-line reading. ReSpec “sources” are transformed into HTML on the fly using a separate Web Service set up (at W3C) for that purpose. Style sheets, images, scripts, etc., are downloaded and included in the book, provided their path is a "subpath" of the original file (ie, they are in the same folder or a subfolder thereof). The service returns the EPUB 3 content that can be stored locally.

The package is not a generic HTML➝EPUB 3 solution.


Generation may take quite some time. Be patient…

Running the service as an API

To run the service directly as an API (i.e., an HTTP GET service):

For an HTML file generated from ReSpec or Bikeshed:
https://labs.w3.org/epub-generator/cgi-bin/epub-generator.py?type=html&url=URL_OF_THE_FILE
For an HTML file with ReSpec that has to be transformed first:
https://labs.w3.org/epub-generator/cgi-bin/epub-generator.py?type=respec&url=URL_OF_THE_FILE

Note that the Bikeshed version is not always reliable in reproducing a proper output. Most notably, the script may fail in finding the full, dated URI of the document and, therefore, cannot establish the document’s publication status. See the documentation for further details.

Source

The source code is available on GitHub. It is fully in Python 2.7. There are two external dependencies: the HTML5lib, and the tinycss Python libraries. The repository also includes a script that can be ran on the command line.