Pelican Org Reader

Overview

Some time ago I tried modifying pelican to work with emacs org mode files.

Somehow I got on the task again today - I think it was due to posts with embarrassingly poor formatting due to the limitations of the approach I used. Thankfully no one really reads this blog >_<.

A simple modification of someone else’s pandoc markdown reader does the job. You can find the plugin at this repo for now, hopefully in the official-plugins soon.

It fixes the most significant to-dos from last time, which include

  • no need for pandoc metadata templates
  • now a plugin instead of in base pelican

It still has a couple issues. Tables do not get pretty styling. And I think there is a bug with pandoc where org mode file code blocks with header arguments somehow break syntax highlighting. Hopefully that gets an upstream fix, soon.

This version would also work much better for other people. Org and pelican are a fantastic duo!

Tests

Code

class OrgPandocReader(BaseReader):
    enabled = True
    file_extensions = ['org']

    def read(self, filename):
        with pelican_open(filename) as fp:
            text = list(fp.splitlines())

Image

Images work but must be reference carefully (i.e. not using the strict org method)

# like this
[[/images/2014-10-02-text-mining-my-org-agenda-files/unnamed-chunk-111.png]]

# rather than, which gives inline image in org file
[[file:images/2014-10-02-text-mining-my-org-agenda-files/unnamed-chunk-111.png]]

Go Top
comments powered by Disqus