Keith,
Maybe you should explore an XML format that can be transformed directly to epub. You'd also be able to write a style sheet with ConTeXt that would out put a PDF as well. I think TEI-Lite is a good starting point.
While XML is one approach and using XML-Styles and DocBook I could even do without ConTeXt completely. Yet, from a general
user standpoint this way of marking up ebooks is tedious. XML has become the standard for storing all kinds of data. A a storage
format it is great and allows for conversion to other formats for ages to come. YET, one has to know what XML is how to use it
how to make tools to process it. That is something that I would not like to enforce on the average author.
Since you can make your own commands in ConTeXt, it will never be able to intelligently map all commands on to simple HTML.
How true. That is the problem with any system that is and can handle more complex structures than a simpler system.
That is why any module geared to creating ebooks has to only allow what is needed and can be done in any EREADER,
(notice I wrote reader not / Book or EPub!)
My Idea is to use the Lua capabilities of ConTeXt to get the job done.
I will try to exemplify.
suggest MWE:
\usemodule[ebook]
\setupcss[…]{…}% see comment #1
\setupmapping[…]{…} % used for when author has his/her own ideas #2
%normal ConTeXt sets see comment #3
% possibly set a mode or set externally
\starttext
\startebook
\chapter… %see comment #4
\startparagraph{leftmargin=20%, …] % see comment #5
% text
\stopparagraph
\starttable…
\stoptable
…
\stopebook
\stoptext
OK, this pretty much looks like standard ConTeXt
Comments:
1) Here is where the author can define the CSS he wants
It will integrated into the CSS used for the ebook
2) The author can setup how the ebook commands are mapped to
ConTeXt commands
3) Here are setups for the NORMAL ConTeXt commands for producing PDFs
4) if mode is PDF command is mapped to normal ConTeXt injected into stream
if mode ebook, gather information for spine, etc, start a new file for the chapter
start writing to this file as HTML
5) if in mode PDF map to ConTeXt command, whereby the leftmargin is used as the
basis for the calculation .2\textwidth or if you wish
This approach is ebook centric. Allows for rapid prototyping and proofing of the ebook using a PDF
This approach alleviates the need to attempt to dumb down ConTeXt markup.
Through the use mappings te author has the possibility of producing a higher quality PDF if wanted.
The system could be designed to produce a file with the ConTeXt commands that can be edited for even
higher quality PDFs of printed versions.
There could be even XML or whatever mode in the ebook module.
Another advantage would be is that we are a module that will produce HTML out of a ConTeXt styled syntax
that can be directly converted to a PDF directly, without worrying about lose of formatting or using tools over
which features are supported or not. This is a straight forward approach.
True, enough, ConTeXt is not designed to be a HTML editor.
It is a matter of design policy! The philosophy of going from TeX/ConTeXt centric to HTML is IMHO far inferior than
going from HTML/ebook centric to ConTeXt. One can always make things more intricate/complicated and taking something
complicated and morphing onto a less sophisticated system.
What one has to keep in mind is that ConTeXt "renders" to PDF and that is what is not needed when producing a ebook.
The rendering is done by the ereader. ConTeXt does have any information about screen size or orientation. ConTeXt is built upon
a page morphology. ebooks are not! So any decent approach has to keep this in mind.
regards
Keith.