Eric Forgy Porting nLab to Mediawiki

See also The Unthinkable

I have no particular skill that qualifies me for the task of creating an itex2MML extension for Mediawiki, but this document represents a diary of my attempt to do so.

Please feel free to leave any comments or suggestions.

Note: Entries and updates are in reverse chronological order.

Bruce Bartlett, 23 August: Hi Eric. Have you tried Blahtex on your Mediawiki server? I’m keen to see if you can get it to work. Seems like it should; development looks dodgy but at least a new version was released recently.

Day 3: June 1, 2009

Not a whole lot of progress, but some interesting conversations with Jacques Distler.

Day 2: May 31, 2009

Update: An interesting comment in the source code of EditPage.php that is not in the documentation:

/**
* Contains the EditPage class
* @file
*/

/**
* The edit page/HTML interface (split from Article)
* The actual database and text munging is still in Article,
* but it should get easier to call those from alternate
* interfaces.
*
* EditPage cares about two distinct titles:
* $wgTitle is the page that forms submit to, links point to,
* redirects go to, etc. $this->mTitle (as well as $mArticle) is the
* page in the database that is actually being edited. These are
* usually the same, but they are now allowed to be different.
*/

I wondered about that. There are two versions of the article. Maybe we can use this.

Update: Here is an interesting comment in OutputPage.php:

01006 if ($this->mArticleBodyOnly) {
01007 $this->out($this->mBodytext);
01008 } else {
01009 // Hook that allows last minute changes to the output page, e.g.
01010 // adding of CSS or Javascript by extensions.
01011 wfRunHooks( 'BeforePageDisplay', array( &$this, &$sk ) );
01012
01013 wfProfileIn( 'Output-skin' );
01014 $sk->outputPage( $this );
01015 wfProfileOut( 'Output-skin' );
01016 }

That, wfRunHooks might be a good place to sneak in a call to itex2MML.

Update: It doesn’t take long for me to get distracted. I think I am developing an infatuation for PHP. I’m also a big GUI fan, i.e. I rarely write a code without throwing a GUI over it, so now I’m looking at

Update: I found the code that parses the wikitext and outputs the XHTML:

Parser

Update: I am now able to take nLab entries and convert them to MML using itex2MML binaries and then display the resulting XML in Firefox.

Here is a second baby photo:

Screen Shot XML

My thought is that we want to get Mediawiki to generate the html, then run the html through itex2MML via command line (as is done in other itex2MML plugins).

Or something…

Update: After getting Mediawiki installed and running, the next thing to do is to try creating some pages. As usual, I created a [[Sandbox]]

First observations:

Next up, try getting itex2MML to work. That was pleasingly easy to do as well with the help of:

itex2MML

I already had Cygwin installed, so simply running

I happily obtained a working executable.

Then, upon reading

MathML and Mozilla

I decided to also install

HTML Tidy

At this point, I’ve got a sample HTML file with a sprinkle of itex:

<?xml version='1.0' encoding='iso-8859-1'?> &lt!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>An Exercise in Groupoidification: The Path Integral | The n-Category Café</title> </head> <body> <h2 class="date">June 13, 2008</h2> <div id="content" class="blogbody"> <h3 class="title">An Exercise in Groupoidification: The Path Integral</h3> <h4 class="posted">Posted by Urs Schreiber</h4> <p>As we have been reminded of by the <a href="http://golem.ph.utexas.edu/category/2008/06/a_groupoid_approach_to_quantiz.html">last entry</a> a while ago some of us had been very busily thinking here about </p> <blockquote> <p> What is the quantum path integral <em>really</em>? </p> </blockquote> So I want to look at this pathetically simple setup: <strong>Background/motivation</strong> target space is a category $P_1(X)$ generated from a <em>finite graph</em>. We fix a finite gauge group $G$ and some representation $$ \rho : \mathbf{B} G \to \mathrm{Set} $$ (where $\mathbf{B}G$ is the one-object groupoid version of $G$). Let's write $V//G$ for the corresponding <a href="http://golem.ph.utexas.edu/category/2008/05/action_lie_infinityalgebroids.html">action groupoid</a>. The background field is a functor $$ \nabla : P_1(X) \to \mathbf{B}G \,. $$ A state is a section of this restricted to points, namely a lift of $\nabla|_0 : P_0(X) \to \mathbf{B}G$ through $$ V \to V//G \to \mathbf{B}G \,. $$ So that's just a choice of element in $V$ over each point. </body> </html>

I’m able to run this through both tidy and itex2MML, which generates an XML file.

Unfortunately, the resulting XML file must contain errors since both Firefox and IE are unable to read it.


The problem with the above file is that it's missing an end to the <div> tag. Put </div> just before </body> to fix that. (Of course, what you really have to do is get that to happen automatically …) —Toby

Eric: Thanks! I fixed the </div> thing and it still complains. It didn’t seem to recognize &rightarrow; for some reason. When I delete everything beyond that point, the equations prior to that render correctly. Awesome :)

PS: I guess the problem is with unicode. None of the unicode seems to display at the moment, i.e. when unicode is included, I get XML errors. Any ideas?

Eric: Is there anything obvious wrong or missing from this in order to make unicode work properly?

<?xml version=“1.0” encoding=“utf-8”?> <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns=“http://www.w3.org/1999/xhtml” xml:lang=“en”>

Eric: Progress. This seems to work

<?xml version=“1.0” encoding=“UTF-8”?> <!DOCTYPE math PUBLIC “-//W3C//DTD MathML 2.0//EN” “http://www.w3.org/Math/DTD/mathml2/mathml2.dtd”> <html xmlns=“http://www.w3.org/1999/xhtml” xml:lang=“en”>


Baby steps…

Speaking of baby steps, here is a first baby photo:

Screen Shot Exercise

Day 1: May 30, 2009

I am currently working on a Windows XP machine (but may switch over to a Vista machine). The first thing I wanted to do was to get a working copy of Mediawiki. I found this article to be helpful:

Manual:Streamlined Windows Install Guide

The first step was getting XAMPP installed:

XAMPP for Windows

That was surprisingly painless.

The next step was to install Mediawiki.

That was also surprisingly painless. Within a short time I had my very own local version of Mediawiki running on my Windows XP machine.

Revised on August 22, 2009 at 23:51:31 by Bruce Bartlett