There are two parts to this, sage -> MathML (which is what the rudimentary _mathml_ methods are for) and MathML -> sage (which it seems you've written, and might be more useful).
To include this into Sage, I would probably create a file sage/interfaces/mathml.py with a single parse_mathml(...) function in it. Follow the developer guide to create a patch, write doctests, etc.. This would return a newly constructed Sage object from a mathml string. Even just attaching your code to http://trac.sagemath.org/sage_trac/ticket/13086 would be useful as a first step (and probably allow for more specific advice). - Robert On Mon, Jun 4, 2012 at 1:46 PM, kcrisman <[email protected]> wrote: >> >> BTW, we have built a MathML -> "Sage input" translator. This allows us to >> take simple expressions produced from, say, the MathDox formula editor and >> pass them to Sage for processing. How do I submit this for inclusion in >> Sage? I have never felt sufficiently confident to want to submit any of my >> efforts heretofore, but this works fairly well. >> >> John A. Velling >> > Hi John, > > I think we spoke at the Joint Meetings about some of your projects, a > conversation I wasn't able to follow up on due to time constraints (though I > still have your email on a Sage business card). Here are some things you > may want to do with this; this sounds quite valuable. > > First, look > at http://trac.sagemath.org/sage_trac/browser/sage/misc/mathml.py which is a > (very old) implementation of some kind of MathML output from Sage thing. I > have no idea if it is any good or works, given that there are no docstrings > :) and there is also > > sage: search_def('mathml') > misc/mathml.py:57:def mathml(x): > rings/integer.pyx:1035: def _mathml_(self): > rings/rational.pyx:705: def _mathml_(self): > symbolic/constants.py:239:def unpickle_Constant(class_name, name, > conversions, latex, mathml, domain): > symbolic/constants.py:268: def __init__(self, name, conversions=None, > latex=None, mathml="", > symbolic/constants.py:414: def _mathml_(self): > symbolic/expression.pyx:669: def _mathml_(self): > > so at least a tiny bit of support, but it's very rudimentary. Here's one > doctest: > > sage: mathml(pi+2) > MATHML version of the string pi + 2 > > For some history, some comments William made a few years ago. > http://www.mail-archive.com/[email protected]/msg00234.html > > I suppose that when we switch to MathJax we could potentially do a Sage -> > MathJax -> MathML conversion trip. Does jsmath support MathML? I don't > think so. > > Also, unless this was you, which I don't think, others have asked about > this. See for > example http://ask.sagemath.org/question/527/parse-and-evaluate-mathml - so > this is a great project. > > Finally, where to contribute? Amazingly, there isn't an open Trac ticket > for this. I've opened http://trac.sagemath.org/sage_trac/ticket/13086 for > this. All you have to do is acquire a Trac account > (see http://trac.sagemath.org/sage_trac/ for instructions, this is not hard) > and post code. > > Ideally, of course, this would be something created using our standard > developer workflow (see http://www.sagemath.org/doc/developer/index.html) > but I'm not sure exactly how you've put it there. I feel like this should > go in sage/interfaces/mathml.py, and maybe the "old" stuff should too. See > http://trac.sagemath.org/sage_trac/browser/sage/interfaces/r.py or other > files in sage/interfaces, especially the def _sage_(self): methods. > > If some students helped, so much the better - we love having new > contributors and helping students see that computation and math go together. > > Good luck! > - kcrisman > > -- > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/sage-support > URL: http://www.sagemath.org -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
