Skip to content

Commit

Permalink
Org reader: fix markup parsing in headers
Browse files Browse the repository at this point in the history
Markup as the very first item in a header wasn't recognized.  This was
caused by an incorrect parser state: positions at which inline markup
can start need to be marked explicitly by changing the parser state.
This wasn't done for headers.  The proper function to update the state
is now called at the beginning of the header parser, fixing this issue.

This fixes jgm#2504.
  • Loading branch information
tarleb committed Nov 8, 2015
1 parent da05619 commit e3b4844
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Text/Pandoc/Readers/Org.hs
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ headerTags = try $

headerStart :: OrgParser Int
headerStart = try $
(length <$> many1 (char '*')) <* many1 (char ' ')
(length <$> many1 (char '*')) <* many1 (char ' ') <* updateLastPreCharPos


-- Don't use (or need) the reader wrapper here, we want hline to be
Expand Down
11 changes: 11 additions & 0 deletions tests/Tests/Readers/Org.hs
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,17 @@ tests =
"* This: is not: tagged" =?>
headerWith ("this-is-not-tagged", [], []) 1 "This: is not: tagged"

, "Header starting with strokeout text" =:
unlines [ "foo"
, ""
, "* +thing+ other thing"
] =?>
mconcat [ para "foo"
, headerWith ("thing-other-thing", [], [])
1
((strikeout "thing") <> " other thing")
]

, "Comment Trees" =:
unlines [ "* COMMENT A comment tree"
, " Not much going on here"
Expand Down

0 comments on commit e3b4844

Please sign in to comment.