This repo contains the Emacs package “oje” to export an org-mode journal for use with Nikola, the static site generator. Each org-mode journal entry will result in a “blog” entry for Nikola. This means that the same day of the org-mode journal can yield multiple blog entries.
The package is still under development. Although I can use it and it works for me on my main development PC, there is no guarantee that it works for anybody else, or even for me when I install it on another PC.
I have developed and tested oje with Emacs 25.3.2 and the packages that come with it.
With regard to org-journal, oje assumes the following settings:
(setq system-time-locale "en_US.UTF-8")
(custom-set-variables '(org-journal-file-format "%Y%m%d.org"))
(setq org-journal-date-format "%F, %A")
With regard to Nikola, oje has been tested with Nikola 7.8.10. You have to install the Nikola orgmode plugin:
$> nikola plugin -i orgmode
There are several ways to install the package. For a minimal installation you download the main file oje.el to you local directory and load it from your Emacs initialization file:
(load "path/to/oje.el")
You can also clone the repo to a local directory, e.g.
$> git clone https://github.com/swinkels/oje.git
and load the file from there.
If you use the tool Cask to manage package dependencies for your local Emacs
configuration, you can use its cask link
command to link your local clone (or
download) of oje to Emacs:
$> cask link oje /path/to/oje-dir
The function to export you journal entries is export-journal-entries. It has two parameters:
- the path to an org-journal file that contains the journal entries of a single day;
- the path to the directory to which the journal entries will be exported.
The exported journal entries are ready for consumption by Nikola.
Currently I use the following snippet to export my org-ournal:
;; This snippet shows how to use oje to export all org-journal entries in your
;; org-journal-dir directory. It assumes package oje has been loaded.
(require 'f)
(require 'oje)
(let ((dest-dir "/home/pieter/repos/github.com/nikola-journal/posts")
(journal-files
(f-files org-journal-dir (lambda (file) (equal (f-ext file) "org")))))
(mapc (lambda (journal-file) (oje-export-journal-file journal-file dest-dir))
journal-files))
oje is developed using Cask, “a project management tool for Emacs Lisp to automate the package development cycle”. For information about the installation Cask I refer to its website. In this README I only show how to use Cask for the development of oje.
In the directory of your clone of oje, execute the following command to download its development dependencies:
$> cask init --dev
This command downloads the development dependencies to subdirectory .cask/
.
There is a Makefile in the root of the repo that offers several rules as
shortcuts to these Cask commands. For example, the command to download the
development dependencies is also available as rule init
of the Makefile:
$> make init
oje comes with some unit tests, which you can find in subdirectory test/
. To
run them, execute the following command:
$> cask exec ert-runner
This command is accessible as rule unit-test
of the Makefile. This rule is
the default rule, so just calling make
runs the unit tests.
Cask is also used to generate file oje-pkg.el from the main oje file oje.el. To do so, execute
$> cask pkg-file
You will have to do this if you upgrade the oje version number.
I have installed oje using the “cask link” method mentioned in section “Introduction”. This setup also allows me to run integration tests on my own personal org-journal.