More details on "Beyond WorkingWiki"

Publish Date: 
Sat, 10/18/2014 - 17:35

In conversation with Matt Senate about today's "Beyond WorkingWiki" post, I've explained myself in more detail, so I'll post that as well here.

The website is checked out from GitHub onto my laptop, in the form of a directory full of markdown files and other resources. I write a blog post as a .wmd ("working markdown") file. This includes text like this:

You can use a ruler to read off the solutions to the quadratic equation, where the line from $$\pm b$$ to $$c$$ intersects the scale.

<p><project-file filename="example.Rout.png"/></p>

The example above shows the solutions to the equation $$x^2-3x-5=0$$.
[...]
Make a nomogram, then define and make example lines.

<source-file filename="example.R" display="source">
eqLines <- function(a, b){
abline(a, b-a, lty=2, lwd=1.5)
abline(-a, b+a, lty=3, lwd=1.5)
}
nomogram()
eqLines(-3, -5)
</source-file>

I run a script to preprocess the file. It extracts the WorkingWiki-style source-file tags, project-file tags, and $$math$$ constructions and replaces them with opaque tokens that will pass through markup processing undigested. I take this token-enabled markup and process it into html using whatever markup processor. (Though to be transparent, on this demo page I'm skipping the markup step and just using HTML with these special tags added.)

Then I run a script to postprocess the file. It expands out all those opaque tokens:

  • display source-file tags as source listing (or in other ways, but never mind)
  • write the content of source-file tags into the WW-style working directory (on my laptop)
  • expand out project-file tags by running a make process in the working directory. This does the computations.
  • display each $$math$$ construct by processing the latex math into MathML. This is done in the same way, by writing it into a directory as a source file, running a make job, and retrieving the result.

So, long answer to a short question: it does much of what WorkingWiki does, but locally on the laptop, not on a wiki server.

[See also for more followup Cloud and virtualized possibilities for "working markup" processing.]

Post new comment

Drupal theme by Kiwi Themes.