July 31, 2008 | Mediawiki Parser: Episode(s)

Posted by Shane at 12:32 pm
Topics: programing | Tags: ,

As most of you know, I am heavily involved with the Battlestar Wiki Project (which is part of FrakMedia! Productions) and we done a lot of work on the English wiki were we detailed almost every aspect of every detail of all the shows, events, characters, etc. in the wiki. The only new information I am seeing recently is from current episodes.

In any case, we link to episode pages a lot to satisfy a number of “mandated” conventions: cite, cross-referencing, etc. Usually inside a template we have to code it the long way out if there was multiple times that we had to refer to different episodes.

| sometemplatevar = [[33]]<br/>[[The Hand of God (RDM)|The Hand of God]]

Always a very unpleasant thing to do. So we were working on a new sub-wiki called “Battlestar Props” which is going to be a central repository on the props used in the show. One of people I work with suggested that we able to input into a template the production numbers of the episode(s) (eg. 101, 110) to render the links for us. I thought that was a great idea. So… the Episode parser was born!

The idea was to take this in a template:

| episodes = 101,110

And have it create links to the pages of those episodes without having to do the work of manually making the links in the templates.

About a half hour after I started the project to create the parser, it worked. :D Getting into the code is not something I am going to do in great depth here. Basically you can now take this code:

{{#episode:%episode%|101,110}} or {{#episode:%episode%|{{{episodes}}}}} (Using the template var above)

… and it will output …

[[33]]<br/>[[The Hand of God (RDM)|The Hand of God]]

This will become quite usefull as it will save us lots of time of creating pages. I created a page of the entire usage here if you want to see the full options. That’s about it!

[Slashdot It!] [Digg!] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon] [Yahoo!] [furl!] [newsvine] [blinklist] [spurl] [gnolia]
2 Comments | Comments Closed
  1. Joe Beaudoin Jr.
    July 31, 2008 at 12:53 pm | Permalink

    Looks like your recent post somehow jacked your front page. :(

  2. Shane
    July 31, 2008 at 12:53 pm | Permalink

    Trying to figure out why “Read more…” does not work on the main page. :(

Sorry, the comment form is closed at this time.