ixmatus / orgmode-parse

Attoparsec parser combinators for parsing org-mode structured text!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support LOGBOOK

gleber opened this issue · comments

It would be nice if orgmode-parse supported documents like this:

* Testing
:LOGBOOK:
CLOCK: [2015-10-05 Mon 17:13]--[2015-10-05 Mon 17:14] =>  0:01
:END:

 Some paragraph text, yada-yada.

Currently it behaves like this:

Prelude Data.Attoparsec.Text Data.Text Data.OrgMode.Parse> test <- readFile "/home/gleber/test.org"
test :: String
Prelude Data.Attoparsec.Text Data.Text Data.OrgMode.Parse> parseOnly (parseDocument []) (pack test)
Right (Document {documentText = "\n", documentHeadings = [Heading {level = Level 1, keyword = Nothing, priority = Nothing, title = "Testing", stats = Nothing, tags = [], section = Section {sectionPlannings = Plns (fromList []), sectionClocks = [], sectionProperties = fromList [], sectionParagraph = ":LOGBOOK:\nCLOCK: [2015-10-05 Mon 17:13]--[2015-10-05 Mon 17:14] =>  0:01\n:END:\n\n Some paragraph text, yada-yada.\n"}, subHeadings = []}]})
it :: Either String Document

This is a case of a more general problem: drawers can be named however the user desires and a drawer may contain anything but a headline and another drawer.

As I'm reading on this, technically, we have two reserved drawers and then arbitrary drawers. The current implementation is correct with respect to the special property drawer, it seems. We need to treat the special LOGBOOK drawer. Then we also need support generic drawers.