Release management with Semantic MediaWiki

I did some wiki markup hacking today to make the release management process for Mozillians.org just a tiny bit easier.

Mozilla uses Semantic MediaWiki for its public wiki. Everyone affectionately calls this instance wikimo. Semantic MediaWiki is a powerful tool, and is kind of fun if you think adventures in extreme punctuation are fun. (I do!)

Part of my job is to communicate about web development projects to various stakeholders, and the wiki is one tool I use to accomplish that. I use it to publish project plans — it’s great for those. I also use it to keep track of meetings and product releases, and it’s kind of annoying for those.

wikimo

These kinds of content — meetings and product releases — follow a familiar pattern: An ordered list of content items links to each individual item, and each individual item uses the same layout as the other items. When a new item appears, the list gets longer. Just like a blog, in fact.

But, to date, maintaining this content has meant creating a new page for a new content item, and putting the right markup into it for that content item, including a few variables, and then editing the page where the list is to add another item to the list. Like I said, it’s kind of annoying.

I’d really like to have a link, and when I click on the link I would get a form to enter my variables. Submitting the form would create the new content item, update the list, and I could move on. Enter Semantic MediaWiki’s templates, forms, and queries!

1) As soon as you start talking about variables in any content system, you also start talking about templates. Semantic MediaWiki lets you build templates for wiki content. Here’s the one I built:

This template puts some explanatory text on the page (“Features landing…”) using wiki markup, and the sky is the limit on that. But more importantly it uses wikimo’s very own bugzilla plugin to drop some bugzilla bugs into the page in a nice tabular format, and it also makes this release page known to the page that lists releases. It uses two user-defined properties to accomplish that:

  • A Milestone property, which should correspond to the values of Bugzilla’s target milestone field — in this case, it’ll be something like “2013-09-26”, because our target milestones are all ISO Thursdays.
  • A Release-list property that contains the value, “Mozillians”. This is what our list of releases will be looking for in order to list releases.

If you visit the template you’ll just see the content in the <noinclude> block. You actually have to visit a page using the template to see what it outputs.

2) Semantic MediaWiki’s templates are not form-powered without the Semantic Forms extension. It’s installed on wikimo, luckily. Here’s the form I built:

A lot of this is default content — the buttons at the bottom, for example, are pretty straightforward. So let’s talk about the critical parts:

1) The {{{info}}} tag. Its page name parameter specifies the name that any page created from this form should get. In this case, it’ll get the Milestone value from the Mozillians Release template (which we defined above). So the title of a page created using this form will be something like “2013-09-26”.

2) The {{{for template}}} tag. This specifies that submissions made to this form will fill up properties in the Mozillians Release template. It also describes the fields on the form.

If you visit the form you’ll just see the content in the <noinclude> block. You have to visit a special link to use the form.

3) You can create that special link with the {{#formlink:form}} tag. It specifies the template to use; the link text to use; and a query string parameter. Remember, when the form makes a new page it’ll just have a name like “2013-09-26”. But we actually want it to have a name like “Mozillians/Releases/2013-09-26”. We’ll send that “super_page” as a parameter in a query string to the form:

{{#formlink:form=Mozillians Release|link text=Make a new mozillians release|query string=|super_page=Mozillians/Releases}}

4) Finally, we have a link to follow to a form that uses a template to create a release. And we want to list releases. Here is the inline query code to do it:

Here’s what that dense little punctuation poem does:

  • Show all the pages that include a semantic mediawiki property called “Release-list” whose value is the name of this page (in this case, “Mozillians”). Remember the “Release-list” property in our template?
  • Show them as a list.
  • Order them with the lexically largest page name first. Since our page names are uniform strings with ISO dates at the end, this floats new releases to the top.

Putting it all together, I can now create a release page that displays all the bugs associated with a release, and have that release listed in a list of releases, in one easy step. Which, I hope, will mean our release documentation cleaves just a tad closer to the truth.

Note to anyone considering doing something similar on wikimo: You will inevitably create some test pages as you experiment with this. A friendly wikimo manager suggests that you create them in your own personal wiki namespace, which you can access at a link like this: https://wiki.mozilla.org/index.php?title=User:YOUR_USERNAME/.

Release management with Semantic MediaWiki