![]() |
generating epub 3 with mathml?
Can calibre convert xhtml+mathml to epub 3 with mathml? Would I be able to open the resulting epub in calibre and have the math render properly? Since ebook-convert detects the desired output format using the file extension, it seems like there would be no way to say that you specifically want epub 3 output.
I guess it would also be nice to have support for epub 3's fallback mechanism for providing a bitmapped image on readers that don't support mathml. But even lacking that, I think it would be fun and cool to be the first kid on the block to be able to produce a valid epub 3 book with mathml in it. (One could always just distribute separate epub 2 and epub 3 files.) The IDPF doesn't even seem to have included a sample with epub 3+mathml in their directory where they've made sample files available. |
As far as I know neither Calibre or any reader device supports mathml.
|
Just for grins, I gave it a shot. It doesn't look like there is anything really major wrong, just a few minor things.
I made an xhtml5+mathml document, which I fed into ebook-convert to create an epub. Calibre generated output that kept all the mathml in there, which was the right thing to do. When I viewed the output epub, the mathml couldn't render the math, but it gracefully degraded, which is also the right thing to do. (E.g., superscripts just didn't show up as superscripts.) As far as I can tell, there are only a few minor tweaks needed to get the converter to generate epub 3+mathml output that would be appropriate for future readers that can render mathml: There needs to be a command-line switch to tell it you want epub 3 rather than epub 2. When that switch is set, it needs to write xhtml5 rather than xhtml 1.1, set the mime type to application/xhtml+xml, and write output files with extension .xhtml. The mathml property of the manifest item element should be set if there is mathml in the document. That can be done regardless of whether the user sets the switch requesting epub 3. |
The mimetype is set to application/xhtml+xml (that is needed for epub 2) and I don't see why it should require the file extension to be xhtml.
Really the only thing that needs to be done is converting xhtml 1.1 to html 5 which should be fairly trivial, except in the case where the document contains namespaces other than svg/mathml. But you still wont have any readers capable of displaying the MathML |
Thanks, itimpi and Kovid, for the replies :-)
Quote:
Quote:
Code:
<meta content="http://www.w3.org/1999/xhtml; charset=utf-8" http-equiv="Content-Type"/>Quote:
Quote:
Quote:
|
In case it's of interest to anyone, here is some ruby code I wrote to patch an epub+mathml file output by calibre and make it into valid epub 3. All it does is change the doctypes and add properties="mathml" to each html item in the package document.
Code:
unless File.exist?(infile) then fatal_error("in patch_epub3: input file #{infile} does not exist") end |
Unfortunately, I have about 300 things on my plate that would be relevant now, rather than in the future :) But, patches are most welcome :)
|
| All times are GMT -4. The time now is 10:22 PM. |
Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.