Automatic Date Links in MediaWiki

I had time between 1:1s today to solve a wiki problem that’s been nagging me. My codes, let me show you them.

Problem: We have meetings.

What’s worse, we persist in having them every week. Being the kind of project we are, we keep agendas and notes from those meetings publicly and invite the community to participate (does your browser? Great!)

What you want, then, is for each week’s meeting notes to link to next week’s and last week’s, like such:

And so, we do. But those links have to be hand-edited every week. Indeed, the pages for various meeting notes have earnest, heart-wrenching pleas in HTML comments, like

<!– REPLACE YYYY-MM-DD with the previous and next week’s year-month-date –>

No one should have to live like that.

Solution: ParserFunctions

Our mediawiki install includes the ParserFunctions extension, which has a whole bag of tricks. One of these tricks is {{#time}}. #time lets you produce various kinds of time/date strings, to wit:

{{#time: Y-m-d }}

Particularly nice, though, is that you can specify relative times, e.g.

{{#time: Y-m-d|+1 week}}

The relative syntax is so flexible, in fact, that I can utter this monstrosity:

[[Platform/{{#time: Y-m-d|tuesday last week}}|« previous week]]

to link to last week’s notes from a given page!

Still with me? Because there’s one snag left. The above works for people who have a static front page with this week’s info, and only ever want to link one week back. But those relative dates are relative to now — what if I want each link in the chain to link to the week prior?

No problem — our pages are named according to their dates, so just make the link relative to that, instead:

[[Platform/{{#time: Y-m-d | {{SUBPAGENAME}} -1 week}}|« previous week]]


The things you learn while waiting for a phone call. If you want to get really exciting, you can do all this in transclusion tags, to have last week’s notes automatically added to this week, but that’s left as a terrifyingly-recursive exercise for the reader.

What’s your favourite mediawiki hack?

(PS – Full credit to Melissa for giving me the idea in the first place. I am naught but the implementor.)

4 More Hacks

Last week was a Mozilla Corporation all-hands, which is typically an exhaustingly generative time. Some of these bits fell out, in the interstices between working and sleeping; the drinking times.

Bugzilla History Jetpack

I put together a jetpack to annotate show_bug output with the bug’s activity, so that you can track flag changes, state changes, reviews, &c. The idea was all beltzner‘s originally, but I’ll take credit for the half-assed implementation, anyhow.

If you don’t yet have the jetpack engine installed, go get that first. Once you’ve got that, you can grab the bugzilla jetpack itself.

[N.B. Since that’s just my generic bugzilla tweaks jetpack, you will get, for no extra charge, the one-liner that removes “Bug ” from the start of bug titles, so that the bug number fits better in your tab strip. At some point I’ll probably add it to the jetpack gallery without the ride along, but you want it NOW.] Jetpack

I also fixed flickr so that photo pages which have a shortform URL have that URL added just below the photo, for easy copying. It’s also a jetpack. This one I actually added to the gallery, grab it here.

EXIF in Flickr

One more jetpack. I wanted to play with flickr’s awesome, awesome API, and I want EXIF data for flickr photos without a separate page load and I didn’t want it to look very nice. Presto.

Jury-rigged IRC

On the flight home, we had an adhoc wifi network running, which enables 1-on-1 iChat but is no good for multi-party. None of us had an ircd kicking around, so I knocked this together. It mostly works, but I bet you can offer improvements. (yes, nc would have worked here too, but ncat is neat, and does SSL).

tail -f log1 | ncat -lk 2000 >> log1

cat - | sed -l "s/^/[`date +%H:%M`] < @johnath> /" | ncat 2000

Extra Credit

  1. Before making the history jetpack, I had it mostly working as a bookmarklet in 498 characters. Can you make it tweetable (140 chars)?
  2. The history jetpack is scraping the show_activity content instead of using the new REST API. Patches accepted?
  3. The EXIF jetpack should do a nicer job of highlighting what matters.
  4. Local echo on the chatroom was kind of annoying, we ended up opening two “clients” each – one for typing into, and the other for seeing the unmunged chat stream. Got a better one liner?

Car Quips

Car QuipI have always wanted an LCD Panel for my rear window in the car. It always seemed like it would be exceedingly handy to have the ability to fire off one of several pre-canned messages or, if I had a passenger, have some kind of keyboard where they could provide context-appropriate messaging for the cars around me. “Your turn signal is on.” “Your high beams are blinding me.” “That is a very big SUV, clearly you suck.” And so forth.

LCDs are still a good idea, but one can accomplish the same goals in a cheaper, lower maintenance, and much more analog way. What I have made instead is a coil-bound flip book with 14 standard messages I might find myself needing, plus three laminated blank pages at the end on which I can add messages with dry-erase markers. The whole thing is designed to fit in my glove compartment, and has forward and mirror-image versions of each message on facing pages so that cars in front of you can read it through their rear view mirror. Obviously the messages have to be kept short to maximize font size, but other than that, the sky’s the limit. In the hopes that someone other than I can see the value in such a book, I present:

Building your own Car Quips booklet
Continue reading “Car Quips”

A Secret Passion

The smell of it, as I remove the shipping wrap is sharp. The paper smells freshly cut and printed. It is heavier than I remember.

I glide my fingers across the gloss of the cover, down the spine.

Like any good piece of literature, it is more than the sum of its parts. There are individual pages, individual passages which are artful, beautiful. But taken as a whole it transforms, it blends and mixes and unifies. It breathes. And it speaks. It speaks about a world of possibility and the search for substance over style. Of a lost generation’s yearning to understand what is real and good and pure – maybe of every generation’s need for that sense of solidity; of gritty, healthy profundity.

Of course I devour it. The anachronism, the self-contradiction, it does not engage, it compels. Every page makes you want to live up to it, to be worthy of what it offers. It would be difficult, and expensive, but you think about who you would be if you could really master and harness those forces. You would need no other god. You could literally reach out and grab the world and form it to your will and set it back and say “There. It is done. I have created. And I have done it with love, and with precision, and it is beautiful and it is real.”

The Lee Valley annual catalog is better than porn.