Andrew Stacey


About
Andrew Stacey
Information about my research, teaching, and other interests.

By: Andrew Stacey
Contact details


Andrew Stacey


blosxom icon


Tue, 9th Mar 2010 (HowDidIDoThat :: nLab)

Converting the nForum to MathML

A side benefit of the awesome SVG-Editor in instiki is the creation of a public itex server. This makes it possible to send some itex off to the server and get back some MathML. A bit like those public latex servers that convert latex equations to images, but better. So if a forum can use latex->png's to display mathematics, surely it can use itex->mathml ...

The nForum runs on the Vanilla forum platform. Vanilla gets bonus marks for already serving XHTML, so it's not hard to switch it to XHTML+MathML+SVG. One change is needed to the main code: in the file appg/headers.php the content-type needs changing to application/xhtml+xml. Next, one needs to use a MathML-aware theme. Fortunately, it's not hard to adapt the default theme to be valid XHTML+MathML+SVG. The way I constructed that was to change the header and then keep feeding the pages through the w3 validator until everything passed.

The next question is how to generate the MathML. Given that the nForum supports the nLab, which runs a variant of markdown with itex, the obvious solution was to write a wrapper around markdown that essentially did the same. The result is the Markdown+Itex formatter. This also incorporates the wikilink plugin so it all happens in one place.

Various existing plugins also needed modification to work correctly. For some, the modifications were minor: mainly replacing ampersands in URLs with entities. For others, the modifications were a little more serious. Here's a complete list of the extensions that the nForum uses, together with a summary of the modifications.

  • ApplicantEmailVerification
  • CategoryRoles
  • CheckNames
  • CustomStyles
  • DuplicateEmailCheck
  • FeedThis
    Lots of ampersands needed escaping here.
  • ForcedCategory
  • GuestPost
    Guest posts are only allowed in one category on the nForum so this is only turned on in that category. In that category, guests can also start discussions (not just comment on existing ones). More seriously, reCAPTCHA does not serve and has no intention of serving valid XHTML so the form has to be redesigned. Fortunately, I found someone else who'd already done that and used theirs as a template. (The reload captcha and audio versions don't work yet.)
  • GuestSignIn
  • GuestWelcome
  • HtmlFormatter
  • ksesXHTML
  • MarkAllReadRedux
    A stray ampersand got hunted down and escaped.
  • Markdown
  • MarkdownItex
  • MembersList
  • NewPostNotifier
  • ParticipatedThreads
  • PreviewPost
  • PseudoTabs
  • reCAPTCHA
    As with GuestPost, this needed extensive modification to make it valid XHTML.
  • RemoveStickyDiscussions
  • ReservedNames
  • RoleListFix
  • SetList
  • StickyOrder
  • SubCategories
  • Textile
    Couple of spaces misplaced.
  • vLaTeX
    In the process of writing the Markdown+Itex extension, this got severely updated.
  • Wikilinks

Resources

[Full link]
Last modified on:
Tue, 9th Mar 2010