Feed on Posts or Comments 21 May 2012

MediaWiki robchurch on 23 Dec 2006 10:41 am

Dates

A long-standing request has been to allow users to have MediaWiki’s date reformatting applied to dates which aren’t linked. As it stands, the software will (if enabled) detect linked dates such as [[January 2]], [[2006]], and reformat them to the user’s preference, e.g. [[2006]]-[[01-02]].

This is all well and good, but that means that all dates have to be linked, and users don’t like that, since it creates a higher number of superfluous links per page. So it’s a bit of a bummer at the moment.

I was working on a proof-of-concept, hacked-up parser hook for a tag, which would allow users to wrap up text where free dates should be refactored. At first, I tried to adapt the DateFormatter class, but so far, that’s proven to be a little bit icky, so I’m about half-way through rolling my own.

It’s all going fairly smoothly so far; I need to handle partials, such as [[January 20]], but I can reasonably detect all eligible date formats and refactor them to a set format. The class I’m writing, DateParser, references a smaller class, Date, which handles representing a given date and formatting it to a given standard…the code’s still a bit hackish, but mostly there.

With luck, I’ll get that cleaned up and tested more thoroughly over the next couple of weeks, and then look to put the solution into people’s hands as soon as possible.

Trackback This Post | Subscribe to the comments through RSS Feed

Leave a Reply