Org-Mode file parser and writer
Usin Vim for a long time, and having used e-macs for a while I got hooked on org-mode. The flexible plain-tekst planning mode.
Using org-mode was an eye-opener, brilliant idea, using it almost a reason to stick to emacs in combination with evil=mode. But it turns out I am more of a VIM person.
Looking on the web I found the vim-orgmode bundle. Which provides highlighting and other basic functionality. But I need more. An agenda view, A quick overview of open tasks per project, anything I would like to extract in the future.
To do this I need a nice abstracted setup of parsing org-files and re-writing/re-presenting the information in a nice and clean way.
Making lightweight/fast ruby org-mode executable to parse/reformat/analyse and report on my org-files or the one in my buffer. And following the Unix philosopy making a seperate process for it.
What I want
- flexible parsers
- flexible writers
- potentially database storage
- maybe an org-mode website to upload / store org-mode files
- well tested ruby code
- integration with vim
- flexible reporting
- remember mode
- git integration
Follow my progress at: github
Main cmdline pipeline
An org-mode script does the following:
org-file(s) => parse => perform action => present/write result
After some experimenting I came down with the following architecture for this commandline utility.
The domain objects of an org-mode file is pretty simple
OrgMode FileCollection File Node
Where file represents an org-mode file. It contains all necessary data to generate a nicely formatted org-mode file.
Node is an item in an org-mode file, always starting with a title following some content.
* TODO I am a OrgMode node Content of orgmode node
You can see the source here: org_mode.rb
A parser is responsible for building up the domain objects out of a org-mode formatted file.
# parser -> returning domain objects OrgMode::FileParser -> OrgMode::File OrgMode::NodeParser -> OrgMode::Node
Reporters take the domain model and extract certain information out of the domain model. It essentially constructs datastructures which can be easily presented by the presenters.
Presenters present the data contructed by the reporters in some kind of format. This can be anything. I will start with simple commandline interaction so they will be strings.
OrgMode::Presenters::String Agenda OrgMode::Presenters::Html
Commands handle the command line interaction cmdline interaction essentially parses the supplied org-mode files or recursively scanned directory and displays the information use one of the available presenters