Blog Housekeeping

I’m making some changes to this blog. I’ve been unhappy about the fact that all the code is static, not the code I use every day. Instead, I want a nice code repository, so whatever I write on my machine can be published directly, and if I update it, the updates end up here. I would also like syntactical highlighting of the code. And now, ta dah! It’s all done. Here’s what I did, for your reference and my own, because I’ll forget next time I need to update it.

So from now on, new code on this blog will look like this:

[include file="../../code/Arduino/helloTom/helloTom.pde" start="3" clean="true"]

And it’ll all be updated whenever I make changes.  Exciting, isn’t it?

First, I set up a webDAV directory that’s linked to my code directory on my laptop. I’ll be switching to git soon, as I have a good bit of code on gitHub now.

The WordPress plugin WP include-file does a nice job of pulling in remote files.  It doesn’t do anything to make sure the included code is HTML-safe, though, so I made a slight change to it.  Line 88 looks like this now:

$content = htmlentities(ob_get_clean());

The htmlentities() call cleans up things like the pointy brackets on some code includes, for example. Handy.

For code coloring, I use Syntax Highlighter Evolved, which is a wrapper around the javascript Syntax Highlighter. It has syntax coloring for a lot of languages, but not for Arduino or Processing, but Alex has a good post explaining how to add new brushes. Fortunately, Sebastian Korczak wrote an extension brush for Syntax Highlighter for Processing. Theres also an

That’s it, really. Hope it helps. I expect it’ll help me, at least.