Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

ASCII formulas extension

edited September 2006 in Vanilla 1.0 Help
I'm finishing an extension that grabs any "natural language" (almost) formula between [math] tags and shows it as a MathML formula. It's done via the wonderful ASCII2MathML. Teaser pic here --> http://octavoarte.cl/foroconcurso/vanilla_mathml.jpg The thing is to display MathML in a webpage you need to: a) have a doctype that includes the MathML namespace: this can be easily included in your themefile, and I could provide the default Vanilla theme + MathML. b) have an application/xhtml+xml mimetype, this is in appg/headers.php, file which is not to be edited by extensions. Plus it breaks IE (as most cool things do). So, I'm looking for a solution to b) before I upload the extension, since without these changes your browser won't display any formulas and validators will go nuts. Maybe there's another mimetype that displays MathML and doesn't break IE, I'll look for that next. Any ideas on changing mimetype for Vanilla?

Comments

  • Options
    Even if you got the mimetype right, you'd still be at the mercy of browsers which may have no idea how to handle mathml. It might be a better idea to find a way to transform ascii math notation into html, which can be styled to look reasonably like math notation.
  • Options
    Or convert the symbology to images, like Wikipedia does.
  • Options
    actually I just got the mimetype right. I found a nifty way to check if the useragent accepts application/xhtml+xml, and if it doesn't it just serves text/html. As for interpretation, the only major browser that does not understand MathML is IE, and there's a plugin (MathPlayer) for that. Converting to images is a bit of a hassle, since you gotta create temporary images, cache them, etc etc. Also they do not scale with the text. Plus, I'll also be making a push for MathML which in my opinion should be widely supported. On the other side, Opera is failing to parse XML for a silly URL parameter-separating ampersand, as it believes it to be an entity, and fails to display. Is the world ready for xml? :s
  • Options
    edited September 2006
    "I found a nifty way to check if the useragent accepts application/xhtml+xml, and if it doesn't it just serves text/html."

    If this nifty way involves checking browser id strings, I highly recommend avoiding it.


    "On the other side, Opera is failing to parse XML for a silly URL parameter-separating ampersand, as it believes it to be an entity, and fails to display."

    That kind of thing happens a lot in XHTML-land. It can be solved by filtering content for unencoded ampersands.
  • Options
    edited September 2006
    "If this nifty way involves checking browser id strings" that woudln't be nifty. You can check HTTP_ACCEPT and the server should report if it accepts a given mimetype. Works like a charm, no hackish js involved. edit: if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) { blah blah } "It can be solved by filtering content for unencoded ampersands" the thing is this ampersand is not to be escaped, since it forms part of an URL. Silly Opera. I downloaded mathplayer and noticed that it wants *very specific* markup to display formulas correctly. This probably will be a hassle. Might turn to images anyway :(( what happened to 'presentation separated from content' anyway? Opera explicitly stated they don't support MathML. I'll give the Mathplayer approach one go, and that's it. They want a xsl link, a namespace for MathML and all the (MathML) tags preceeded by the 'm' namespace. working in xml mode might introduce problems with other extensions, as DOM functions become more restrictive. So.. I'll just might change the approach and go with images. Blech.
  • Options
    edited September 2006
    Well, if you want to use XML, you have to use proper XML. If you want to have an URL parameter-separating ampersand, you use &, because that's the way XML works. Ampersands should be written as & if part of an URL. This goes for XML, this goes for XHTML.
  • Options
    ithcyithcy New
    edited September 2006
    er... i'm afraid you've got that totally backwards, bjrn http://www.w3.org/TR/xhtml1/#C_12
  • Options
    whoa... so that IS right. Props to Opera then. And Firefox 2b, found out it stops on that error too. Still, I guess it's not the time to go full-xml yet. Too much hassle. (3rd party DOM code might break at any moment)
  • Options
    @itchy: Sorry, I meant '&', not '&'. I chose to format my post as HTML, not thinking about that writing '&' would just show up as '&'. I've edited my post to correct it.
  • Options
    hahaha
    "Sorry, I meant '&', not '&'"

    gotcha though
  • Options
    edited September 2006
    /me breaks down Turns out that '&' gets shown as '&', even when selecting Text instead of HTML.
This discussion has been closed.