← The Oakwood Community Bike Rack | New Oakwood Community Site Launched →

Evening Coding Project: Go Diagrams

A couple nights ago, Jayme and I had a goal-setting conversation with one of the Oakwood Community interns, Tyler, to figure out what he wanted to get out of his year with us, and how we could help him get there. One of the things he expressed was that he felt like he was getting too caught up in his computer, and it was interfering with him interacting with other community members and with his ssleep schedule. To help him improve this situation, he set a guideline of not turning on his computer after dinner.

I've similarly been finding myself getting caught up in the lures of the internet, and I think something along the same lines would help me get my life in balance. Except that another goal of mine is to do more on my computer: work on coding projects, write posts for Hark! A blog, be more involved in the open source community. In other words, I want to be producing rather than consuming on the internet. So while I'm not going to ban myself from my computer after dinner, I am going to limit myself to productive work.

In fact, I started last night. In my excitement about Pelican I decided to dig into the internals of reStructuredText and see if I could extend it with a new directive. So now I'm working on a directive to render go diagrams.

The idea is that you could include a snippet like this:

.. go::
    $$ ---------
    $$ | . . . .
    $$ | . . x .
    $$ | . o x .
    $$ | . o o .
    $$ | . . . .

And get back an embedded image of the diagrammed go board. One thing at a time though. Last night, I figured out how to write and register a directive, and how to get a reStructuredText renderer to use the registered directive. Currently, it displays the go diagram verbatim, in plain-text form. The next steps are:

  • parse the diagram
  • load it into a python object
  • render that object into an image file using PIL
  • embed that image file in the generated HTML

I'd also like to get the diagrams loaded into Pelican, so I can render them in my blog.

The code is available on BitBucket as rstgo.

Comments !