Monday, 9 April 2007

testing the interface

Just testing...

I probably won't be posting too much MathML here, but I wanted to check it was possible. Unfortunately I think blogger always serves as text/html, but Peter Jipsen's script seems to work well in this context. Currently it requires a Gecko browser such as Firefox, or IE with MathPlayer installed. Hopefully I can extend the script to allow some basic CSS rendering in other browsers later.

I also needed to check I could write posts in emacs of course!

Finally some examples using the MathML in HTML script. $\frac{1}{2}$

$x=\frac{-b±\sqrt{{b}^{2}-4ac}}{2a}$

[update, continuous Relax NG validation of the mathml in xhtml in atom markup as I type into this emacs buffer. Isn't emacs wonderful. Will post schemas used shortly.]

cyperus_papyrus said...

Okay, this is interesting, and seems to display properly in my browser (which is FireFox). But how do you get blogger to run a script? What I've read about LJ is they deliberately don't let users run scripts because scripts open up security problems. Script tags are stripped from entries.

I'd love to get this to work at LJ, it's just that all the research I did seems to show that they've deliberately closed all the avenues to do this for security reasons.

David said...

Blogger gives some gui widget thing for editing the page elements in the template, but also shows gives you the option of seeing the full text of the html template code and I just cut and pasted the script into there and clicked save...

The script isn't in the document that I posted for this entry, it's in the page template for the whole site.

This will no doubt cause some issues with people reading the atom feed directly in a feed reader of some sort, I'd really like them to get the entry to be classed in the feed as xhtml (rather than html) but its sorting out issues like that that made me decide to get a blog, I'll post as i find out what works and what doesn't...

Keith Brunton said...

Hi David,
I should warn you that Peter Jipsen's MathMLinHTML script has some flaws. I discovered that both browsers have problems with empty elements with just attributes - e.g

I did a little testing to see if I could get roun the problem, but IE, for one, cannot detect the difference between an empty tag with attributes and an opening tag.

Keith

David said...

I tried adding mspace and it seems to work, it displays OK in both IE and firefox I think, and "view mathml source" in FF and "copy mathml" right menu options in IE/MathPlayer indicate that it's correctly parsed as an empty element?

An example on my test blog:
testing mathml

Perhaps my example is too simple?

If you can point me at an example that doesn't work I'll see if I can tweak the script at all...

dpurohit said...

How do you include mathml in comments?

Dayal

David said...

How do you include mathml in comments?

A very good question!, If I find the answer I will post here. On the display side of things MathML in comments should work, but the problem is how to post. The text box comment interface in the blogger websire doesn't allow tags except for a few "safe" html ones, and the GData API as used by the emacs and other interface currently doesn't allow access to the comment feeds apparently. Further experimentation seems to be required...

David said...

An alternative would be, instead of using the mathml in html script (which requires MathML tags in the document) to use the asciimath script available from the same site. That way the math can be marked up just with a linear plain text markup, and so should be acceptable to the blogger comment interface.