Skip to content
19 December 32009 / Robin Wellner


What is Wrong? It is me, doing the wrong thing. I am writing my own content processor/blog generator for gvxStory, instead of using one of the dozens excellent programs written for that purpose. I could just have picked Jekyll, but nooo, I had to make one myself…

So I called it Wrong, in an attempt at humor by self-deprecation. It is written in Python, and in its current shape fully functioning, in under 350 lines.

While blogs are usually focused on the date the piece is written (see for example the URL of this very post — it’s YYYY/MM/DD/title. That’s fine for normal blogs, but I wanted the focus to be on the number of the post. And what Wrong does is this: it looks in every subdirectory, simply copying everything that doesn’t seem to be a Wrong file, ignoring files and directories specified by the user, and indexes the Wrong files, extracts numbers from the filename (1.wrong works, but so does 1-the-beginning.txt and 1st_post), and sorts them according to that number.

If there are conflicting numbers, it checks the setting for resolving those conflicts and acts accordingly. The default is to display an error message and abort the whole operation, but you can choose to let it pick the youngest, the one modified last, or the one with a filename with the highest ASCII value (so that 1-version-b is picked over 1-version-a).

It also has some very cool template features, including the ability to generate different HTML if it is the first or last post in that subdirectory. And it works for posts that are both first and last as well!

The first large project that uses Wrong is its documentation. And that will be epic. To properly document all of Wrong’s settings, defaults and behavior, I will have to write pages and pages. For example, Wrong looks at ~/.config/wrongrc, which can control lots of settings, but they are named consistently with the internal names (in fact, the internal settings are set directly from the strings read from that file), and not with those given on the command line. It also has some delicate recursion problems if you put the publish directory in the source directory, which is the default. That’s why the default ignorelist is [“publish/”]. But if you supply your own ignores on the command line (no, wrongrc doesn’t work here — it only operates on strings, not lists), “publish/” is not included. If you use that directory, you will have to ignore it manually.

But once you know which settings to use to make it work for you, it gets very easy to run Wrong. Writing in Wrong is a breeze as well.

Oh, and a catch: Wrong doesn’t do HTML. It converts everything to HTML, but you can’t write HTML in Wrong. Because that’s not Wrong, that’s just Awful. 😉

If you want to play with it: I have it up on GitHub.


One Comment

Leave a Comment


  1. Stork « gvxDev

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: