Skip to main content

Nikola plugins

I have installed a couple of plugins to help with Nikola page and post authoring.

These plugins are:

  • orgmode
  • txt2tags

The orgmode Plugin

The orgmode plugin uses Emacs in batch mode to provide a means of authoring Nikola posts and stories in .org files for conversion into HTML.

To install it:

nikola plugin -i orgmode

You will get a directory under your Nikola site:

plugins/orgmode

In this directory there are a number of files.

Providing you have version 8.0 or above of Emacs orgmode installed you will not need to do anything with the init.el file.

Pay careful attention to the conf.py.sample file and add the code-fragments to the COMPILERS =, POSTS = and PAGES = entries in your conf.py.

Once that is working correctly then:

nikola new_post -f orgmode -t "post title"

Should create a post-title.org file in your ./posts directory which you can edit using Emacs or Emacspeak and get all the benefits of orgmode power.

The txt2tags Plugin

For this, first you will have to install txt2tags. On Debian or Ubuntu you can do this like this:

sudo apt-get install txt2tags

Now install the Nikola plugin:

nikola plugin -i txt2tags

Again you will need to edit your conf.py file and change the POSTS =, PAGES = andCOMPILERS =` entries.

You can see how to by looking at values for other file types.

Now doing this:

nikola new_post -f txt2tags -t "post title"

Will give you a post-title.t2t file in your posts directory.

Why did I install txt2tags?

Because one of the great things txt2tags does that markdown does not is tables. And another great thing, and what made me install it, is the ability to give include directives in txt2tags files.

If you put this string in your .t2t file:

%!include: filename.t2t

When the page is rendered, the file willbe included. It does not have to be a .t2t file that is included. But the parent file will be rendered with the txt2tags compiler.

It was using the txt2tags plugin and syntax that I created the pages that show tables of reference data such as markdown-mode commands for Emacs. By including files in txt2tags syntax that are converted to HTML tables on the fly.

Why not just embed the files? Well this way I can use all kinds of jiggery-pokery including sed and grep commands to generate the .t2t table files from Emacs key-bindings harvested automatically.

Very neat.