Subtree list items turn into headers
Closed this issue · 8 comments
Bug in 0.2.0
. Consider this org-file.
* Header1
** Header2
*** Header3
:LOGBOOK:
:END:
* Item1
* Item2
** Header4
When logbook is not present, it's parsed correctly. When it is (even if it's empty), we get:
* Header1
** Header2
*** Header3
:LOGBOOK:
:END:
* Item1
* Item2
** Item1
*** Header4
Thanks for the bug report, I'll address this when I have some free time (I'm also open to contributions if you get to fixing it before I do).
I reproduced this issue using the example org document you provided, parsing that document produces the following:
Right
( Document
{ documentText = ""
, documentHeadlines =
[ Headline
{ depth = Depth 1
, stateKeyword = Nothing
, priority = Nothing
, title = "Header1"
, timestamp = Nothing
, stats = Nothing
, tags = []
, section = Section
{ sectionTimestamp = Nothing
, sectionPlannings = Plns (fromList [])
, sectionClocks = []
, sectionProperties = Properties {unProperties = fromList []}
, sectionLogbook = Logbook {unLogbook = []}
, sectionDrawers = []
, sectionParagraph = ""
}
, subHeadlines =
[ Headline
{ depth = Depth 2
, stateKeyword = Nothing
, priority = Nothing
, title = "Header2"
, timestamp = Nothing
, stats = Nothing
, tags = []
, section = Section
{ sectionTimestamp = Nothing
, sectionPlannings = Plns (fromList [])
, sectionClocks = []
, sectionProperties = Properties {unProperties = fromList []}
, sectionLogbook = Logbook {unLogbook = []}
, sectionDrawers = []
, sectionParagraph = ""
}
, subHeadlines =
[ Headline
{ depth = Depth 3
, stateKeyword = Nothing
, priority = Nothing
, title = "Header3"
, timestamp = Nothing
, stats = Nothing
, tags = []
, section = Section
{ sectionTimestamp = Nothing
, sectionPlannings = Plns (fromList [])
, sectionClocks = []
, sectionProperties = Properties {unProperties = fromList []}
, sectionLogbook = Logbook {unLogbook = []}
, sectionDrawers = []
, sectionParagraph = ""
}
, subHeadlines = []
}
]
}
]
}
, Headline
{ depth = Depth 1
, stateKeyword = Nothing
, priority = Nothing
, title = "Item1"
, timestamp = Nothing
, stats = Nothing
, tags = []
, section = Section
{ sectionTimestamp = Nothing
, sectionPlannings = Plns (fromList [])
, sectionClocks = []
, sectionProperties = Properties {unProperties = fromList []}
, sectionLogbook = Logbook {unLogbook = []}
, sectionDrawers = []
, sectionParagraph = " * Item2\n"
}
, subHeadlines =
[ Headline
{ depth = Depth 2
, stateKeyword = Nothing
, priority = Nothing
, title = "Header4"
, timestamp = Nothing
, stats = Nothing
, tags = []
, section = Section
{ sectionTimestamp = Nothing
, sectionPlannings = Plns (fromList [])
, sectionClocks = []
, sectionProperties = Properties {unProperties = fromList []}
, sectionLogbook = Logbook {unLogbook = []}
, sectionDrawers = []
, sectionParagraph = ""
}
, subHeadlines = []
}
]
}
]
}
)
... which has incorrectly duplicated the string Item 1
as a sub-heading of depth 2 and it parsed Header 4
into a sub-heading of depth 3 (instead of depth 2).
I can also confirm that if I omit the logbook, these parsing issues go away.
I also verified that adding a :PROPERTIES:
drawer or a custom drawer of any name in-place of the :LOGBOOK:
drawer did not reproduce the issue.
Actually, this issue is present for any property drawer. I incorrectly read the results.
Ah, I figured this out. I was using skipSpace
instead of skipOnlySpace
so the parser consumed all whitespace up-to the next *
character (instead of parsing the whitespace before the *
character so it would be treated as section body text).
PR coming shortly.
@volhovm I also cut a patch release for this bugfix on hackage: https://hackage.haskell.org/package/orgmode-parse-0.2.1
Thanks for your patience :)