Using org mode to write ikiwiki posts
I have been much taken by org-mode in Emacs recently. Firstly, this has allowed me to actually effectively implement the tenets of “Getting things done”, which is amazing by itself. I always used to start with great enthusiasm, which rarely lasted longer than a week. Until org-mode. Then this is so amazingly flexible. It has better handling of tables and even a spreadsheet mode than anything I have used — and it has a pretty decent HTML export function. I practically live in org-mode on work days now. I strongly recommend org-mode, from things like agendas, TODO lists, calendars, appointments, articles, and now Ikiwiki posts.
I rarely ever use markdown, apart from blogging using Ikiwiki – and thus, since I blog so infrequently, I rarely ever remember all the syntax. On the other hand, org-mode syntax is now at my finger tips — so I decided it was time to write a Ikiwiki plugin so I can now write my blog posts using syntax I can actually remember. It is still rough around the edges – firstly, this requires emacs23 (or, on Debian, there is the unofficial emacs-snapshot package), secondly, it uses hueristic hacks to prune away the bits of the stand alone HTML page that org-mode creates; all I can say is that it currently works for me, as you can see from this post. How git this is for mainlne inclusion is another matter.
The code is here: org.pm. It can be dropped in to the Ikiwiki plug-in directory, and that’s all you need. With this, Ikiwiki pre-process things in the input file, and then passes it to emacs to htmlize it.





Comments
Hi!
Perhaps listing it at http://ikiwiki.info/plugins/ would help people find it.
Also, have you seen muse.pm from emacs-muse—Ikiwiki integartion? Technically, it must be similar (it also calls emacs), so perhaps there are some valuable ideas in that code.
Thanks for the useful plugin.
I had to comment out the line ‘$ret=~s/(<\/div>\s*$)//s;’ near the end of the file, otherwise one of the
My code blocks didn’t get htmlized by default either so I also changed the beginning of the eval line to read “—eval ‘(progn (autoload (quote htmlize-buffer) “/path/to/site-lisp/htmlize.el” nil t)(…
If you have emacs22 or non-standard locations for lisp files it is also worth changing the ‘—batch -l’ part to use ~/.mycustomfile rather than ‘org’. In this file I added:
(add-to-list ‘load-path “~/path/to/site-lisp”) (add-to-list ‘load-path “~/path/to/newer/org-mode”) (require ‘htmlize) ;; colour for code segments (require ‘org) (add-to-list ‘auto-mode-alist ‘(“.org$” . org-mode)) ;; not sure if this is needed
(setq org-export-htmlize-output-type (quote css))
;;; and some of my blogging preferences (setq org-export-headline-levels 3 org-export-with-toc nil org-export-author-info nil org-export-with-section-numbers nil
org-export-skip-text-before-1st-heading nil org-empty-line-terminates-plain-lists t org-export-with-sub-superscripts nil)