[NTG-context] EPUB woes

Keith J. Schultz schultzk at uni-trier.de
Mon Nov 18 10:00:10 CET 2013

Hi All,

I find that the ConTeXt approach to creating the EPub is flawed is a fundemental way!


The EPub Standard is a big mess and if you really look at not a true standard in a
true sense.

Let me explain. 
	1) The file structure is well documented and properly defines
             the way a EPub file MUST contain and how file therein must
             be structure and listed. (notice that I use the word MUST)

	2) Now, what a EPub-READER must implement to handle is very
	     little. There are HARDLY ANY provisions that a certified EPuB-READER has
             to implement any particular engine or features therein to display/render
	     the information contain in the EPub-file/wrapper.

In other words it is simply a wrapper file format. and truly nothing more.
There is NO REQUIREMENT in the standard that perfectly valid xhtml or
HTML5 will be  properly displayed in a certified EPub Reader!

The standard has become more strict in recent years, yet still lacking.

Am 16.11.2013 um 18:37 schrieb Aditya Mahajan <adityam at umich.edu>:

[snip, snip]

> When you run `mtxrun --script epub --make test`, it just takes the files specificied in the "files" field, and zips them in as a epub file.
> Now, in principle, any epub reader should support the any XHTML file; in practice, they only support the default XHTML tags. The XML+CSS file that ConTeXt generates are not handled correctly by most (all?) EPUB readers.
	Here is where my critic of ConTeXt approach grabs. What good is if one produces a perfectly correct EPub, yet hardly any EPub reader can
	I remember correctly, an EPub Reader need not implement the handling of xhtml inorder to be certified or, if you wish, adhere to the standard.
	The basic reason why xhtml is handled is because most html renders handle xhtml. 
	Yet, the standard only requires that very basic html features be implemented and the author is required to offer fallbacks incase features are not

> So there are three options:
> 1. Wait until the EPUB readers catch up. It took almost 10-15 years for the browsers to catch up with the HTML standards, and I don't have much hope for EPUB readers here. Last I checked, none of them supported even MATHML-2.
	Like I mentioned above a EPub reader is not REQUIRED to support it!
> 2. Write a script (either using xmlproc, or using you favorite XML parser in your favorite language) that converts the XML generated by ConTeXt into a "standard" XHTML file. This is the easiest and the least time consuming alternative.
	AGAIN, as mentioned above there is no guarantee that it will be displayed properly.
	Support/export of HTML5 would seem to me to be a better option, but then the HTML5 standard is not
	complete and not fully supported by most newer ereaders, also.
> 3. Modify the way in which ConTeXt generates the XML files. Ideally, I should be able to write something like
	Would be nice if there where commands in ConTeXt or a module for defining what should go into the CSS and a 
	mode "epub" where the ConTeXt commands are converted to suitible HTML5 structures that are suitiable for
	most ereaders. 
                       1) margins in percentages
                       2) font sizes based on em
	               3) a new file for every chapter optional for sections user defined
	Just a few. Lots more can be found in any decent documentation on writing ebooks.


More information about the ntg-context mailing list