In the previous post I wrote about how and
why I changed the engine behind my website to Nikola. There was just one thing which got lost in
migration: support for ASCII Box reStructuredText compiler
extension, which provides
asciibox reStructuredText directive. With
asciibox directive, one can compose ASCII text diagrams which then get
rendered as images by reStructuredText compiler.
I decided to share the responsibility of rendering ASCII text diagrams as images in Nikola's output between the following three components:
A tool for rendering image files from ASCII text diagrams. (Renderer)
An extension to reStructuredText compiler for rendering images from ASCII text diagrams defined within the body of
asciiboxdirective. (reST extension)
A Nikola plugin for integrating the reStructuredText extension with Nikola's build system. (Nikola reST plugin)
Their mutual relationships are illustrated in the following diagram (which is
actually defined with
asciibox directive, see the page source):
Renderer and reST extension had already been implemented in ASCII Box as I had used
asciibox directive also with my previous
site generator. So, I only had to figure out how to integrate the reST
extension with Nikola's build system.
Because the actual rendering work and reStructuredText integration was already been taken care by asciibox, the implementation of Nikola reST plugin required just the following two files:
By default, Nikola includes all plugins from the
plugins/ directory, so no
configuration changes had to be made. I only had to ensure
somewhere in Python's module search path for
the plugin to be able to import it.
Now it's all working and I'm a happy user of Nikola!