So. This page describes what I currently implemented and what I'd like to be able to do in general.
currently implemented
The latex formatter has a magic method that tells the latex parser that the formatter is latex, so that it will simply pass the typed latex formula through that magic method that makes it go into the output as-is.
wish
A generic framework to do this.
Each plugin would register what mime-types it can emit (the latex parser would register image/png and text/latex or similar) and the formatter has a list of which mime-types it can accept (currently only text/latex).
Now these should be ordered by preference, with the most specific ones first:
- formatter:
- text/latex
- parser:
- text/latex
- image/png
Now this should be matched and if there is a common match, then the parser should be asked to produce the mimetype and the formatter should be given it. If there is no match, standard formatter calls must be used instead, in this case the formula would simply disappear because images are not handled by the formatter yet.
other problems
- images are passed as URLs to the formatter, which is useless to anything but the HTML formatter. See what workarounds the multipart/latex formatter has to make to get at the image data.
- some formatters (text/latex for example) simply cannot support some formatter features (in the text/latex case: inlined images). Should a list of these be made and added to the mime-types above?