ixmatus/orgmode-parse

Parsing a timestamp seems to only work if SCHEDULED or DEADLINE

stephenjbarr opened this issue · 5 comments

I have been testing the most recent version of orgmode-parse ( e9e034c at the moment ) and it does not seem to parse timestamps that are not part of a SCHEDULED or DEADLINE item. For example, from the timestamps page:

http://orgmode.org/manual/Timestamps.html#Timestamps

* Meet Peter at the movies
  <2006-11-01 Wed 19:15>

* Discussion on climate change
  <2006-11-02 Thu 20:00-22:00>

parses into:

Right (Document {documentText = "", documentHeadings = [Heading {level = Level 1, keyword = Nothing, priority = Nothing, title = "Meet Peter at the movies", stats = Nothing, tags = [], section = Section {sectionPlannings = Plns (fromList []), sectionClocks = [], sectionProperties = fromList [], sectionParagraph = "  <2006-11-01 Wed 19:15>\n\n"}, subHeadings = []},Heading {level = Level 1, keyword = Nothing, priority = Nothing, title = "Discussion on climate change", stats = Nothing, tags = [], section = Section {sectionPlannings = Plns (fromList []), sectionClocks = [], sectionProperties = fromList [], sectionParagraph = "  <2006-11-02 Thu 20:00-22:00>\n"}, subHeadings = []}]})

However, if I change the first item to scheduled:

Right (Document {documentText = "", documentHeadings = [Heading {level = Level 1, keyword = Nothing, priority = Nothing, title = "Meet Peter at the movies", stats = Nothing, tags = [], section = Section {sectionPlannings = Plns (fromList [(SCHEDULED,Timestamp {tsTime = DateTime {yearMonthDay = YMD' (YearMonthDay {ymdYear = 2006, ymdMonth = 11, ymdDay = 1}), dayName = Just "Wed", hourMinute = Just (19,15), repeater = Nothing, delay = Nothing}, tsActive = True, tsEndTime = Nothing})]), sectionClocks = [], sectionProperties = fromList [], sectionParagraph = ""}, subHeadings = []},Heading {level = Level 1, keyword = Nothing, priority = Nothing, title = "Discussion on climate change", stats = Nothing, tags = [], section = Section {sectionPlannings = Plns (fromList []), sectionClocks = [], sectionProperties = fromList [], sectionParagraph = "  <2006-11-02 Thu 20:00-22:00>\n"}, subHeadings = []}]})

Is it possible to get a tsTime structure without making the item SCHEDULED?

Yes it should be, I'll take a look this weekend.

Thanks a lot! FYI I am compiling with GHC 7.8.4.

Going through issues and house-keeping. This needs to be fixed and I'll do that soon I think. Real-life has been keeping me busy, my apologies for falling behind on this.

The org-mode documentation says this about timestamps:

A timestamp can appear anywhere in the headline or body of an Org tree entry.

Therefore orgmode-parse will not correctly handle timestamps that are inside of a headline or the body of a section.

@stephenjbarr I've merged a set of changes that address this shortcoming. Though it isn't perfect because right now it will only parse timestamps in the headline and timestamps that directly follow a headline in the headline's body. It will not pickup timestamps elsewhere in a headline's section body, it's late and that kind of grammar support will be more difficult I think, so this should fix your main pain point.

Sorry this came two years after you reported this 😞