Dear list, In order to ensure a valid DocBook entity with math formulae, the MathML generator must produce valid XML. Right now, it "only" produces valid HTML (which is already quite an achievement!). The difference is in the entities: in HTML, you can use many entities, like ∑. This is no more the case in XML, where you have to define all entities (that is, besides <, >, &, ", '). A solution for DocBook would be to define the needed entities in the XML document, but that would require generating all math formulas, remembering the needed entities, then output the mapping at the *beginning* of the XML document.
There are mostly two places where these entities are hard-coded in LyX: InsetMathDecoration, with only a few entities hard-coded in source code; lib/symbols, a much harder thing to change. Here is what I came up with: https://gitlab.com/gadmm/lyx-unstable/-/merge_requests/3/diffs?commit_id=0c0fc7624caad400f22072442f9132291ee3036d#e90e8f11b4a89e64b3c66669958e7af650b2f526. It adds a parameter to MathStream to enable outputting XML-valid entities. Mappings for InsetMathDecoration are done by slightly adapting the data structure. However, for the other entities, I hard-coded a mapping in InsetMathSymbol (hundreds of entities…), because I could not get my head around lib/symbols. (By the way, in this file, are the "x" mappings symbols that are not yet allowed in output?) Would the patch be acceptable as-is? Otherwise, could a lib/symbols expert (I've heard that there might be one roaming around) help me with this? As I understand it, it would be adding a new column in this file to propose an XML entity after the HTML one. I also attach two patches for MathStream: the second one is my current tentative of implementing XML entities; the first one is about adding XML-name-spaces support (and not really related to the question above, but the second one relies on it to avoid conflicts when merging). Only the second one has been reviewed by Guillaume. Of course, if these patches look OK to you, I'd be happy to see them merged! It's unlikely I'll need to change something there in the near future. Kind regards, Thibaut Cuvelier
0005-MathML-stream-allows-for-name-spaces.patch
Description: Binary data
0016-Convert-HTML-entities-to-XML-entities.patch
Description: Binary data
-- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel