Functional Spec: [[Wiki Links]] WordPress plug-in

I’ve had some ideas for projects kicking around the back of my head for a while. Now that I have some free coding time, I’m planning on getting to them. Or, at the very least, I can document some of my thought processes around them so I can come back to them later, if painting my bedroom seems like a more valuable use of my time.

Think of this as a functional spec. Except (hopefully) more entertaining.

\[[Wiki Links]]
—————

There are a few wiki plug-ins out there for WordPress out there already, so in some sense, I’m re-inventing the wheel. I’ve looked at the code for some, though, and they don’t do quite what I want.

At the bare minimum, this plug-in will allow me to put double square brackets around words that correspond to existing Pages in my blog. Pages are a WordPress thing where you can have static, er, pages that aren’t blog entries. My (slim) [about page](http://www.flyingsquirrel.ca/index.php/about/), for example. I haven’t found them to be terribly useful as they are, but turn them into a wiki and maybe you have something.

For example, if I write this code in my blog:

See my [[About]] page.

You’d see this output:

> See my [About](http://www.flyingsquirrel.ca/index.php/about/) page.

Simple enough. I’d also offer the ability to use Wikipedia-style pipe (|) syntax to give a different link name.

Also, and more importantly, if the plug-in sees that I’m logged in, and the double square brackets are around a word that *isn’t* a page yet, it will show *me* a red link that I can use to create the page. Nobody else gets to see this, of course. Just me.

Eg.

This is a \[[New Page]].

becomes (for me)

> This is a New Page.

(Where the red underlined thing is actually a link).

So effectively WordPress becomes a fairly simple wiki, just like that.

### Short Links ###

There’s one other feature I want to tack onto this thing, though. I’m kinda sick of typing (or, actually, copying and pasting) URLs all the time. Wikipedia URLs, for example, are totally predictable, so I shouldn’t have to type them in all the time. And one thing I miss about posting to LiveJournal is the ability to have a short bit of mark-up to give a shout-out to specific users. It may be feature creep before I’ve even written this thing, but I’d like to support things like that with this plug-in.

So I’d be able to write something like this:

\[[wiki:LiveJournal]] was founded by \[[lj:brad]].

Which would get magically turned into this:

> [LiveJournal](http://en.wikipedia.org/wiki/LiveJournal) was founded by [info]brad.

I’d give the user the ability to define specific prefixes, and define a URL pattern. There would (of course) be a settings page for the plug-in that would allow you to define URL templates. For example, you’d be able to define something like:

wiki -> http://en.wikipedia.org/wiki/%s

Where “%s” is whatever is in the double square brackets after “wiki:”. Wikipedia, fortunately, allows you a pretty free hand when passing them URLs with spaces and other funny characters.

It’s not, however, entirely perfect. For example, there’s no good way to do short Amazon links this way. I’d still have to go paste the URL. Maybe I could do a fancy search look-up thing that would grab an ASIN and put it in a look-up table or something, but that’s beyond the scope of what I really want to do. At that point, it’s probably less work for me to just copy URLs in perpetuity.

One thought on “Functional Spec: [[Wiki Links]] WordPress plug-in”

  1. Cool!

    I like it!

    Simple, achievable, and useful.

    I’d say the Amazon thing is doable, but not without some sort of intermediate lookup (and manual verification).

    Other than that, looking forward to seeing where this goes!

Comments are closed.