They say that most pieces of code are written to satisfy the programmer’s personal itch. I think that’s about right, as I spent around 30 minutes right now writing something that I wanted.
I write my posts in plain text and use Markdown & Smartypants for formatting later. But I then have to manually enter the HTML for the acronym tags required, if any. Surfing around, I found out that there’s a plugin for Wordpress that does this automatically. But its in PHP, and I don’t understand PHP (yet). So I thought, why not write a Python version?
You can download the result if you like. I copied all the default acronyms from the original plugin and put them in a text file which is included (and required) with the script. It was pretty simple really, just create a Unix-like text filter that takes whatever’s given in the input, scans for acronyms, and expands them.
And it was fun…
Next step — make the list of acronyms canonical. It’s filled with only tech acronyms right now.