Org reader: recognize emphasis after TODO/DONE keyword

Fixes: #5484
This commit is contained in:
Albert Krewinkel 2019-05-05 13:53:11 +02:00
parent 545da6113c
commit 7e7bc3493e
No known key found for this signature in database
GPG key ID: 388DC0B21F631124
2 changed files with 10 additions and 1 deletions

View file

@ -273,7 +273,9 @@ headlineToHeader hdln = do
todoKeyword :: Monad m => OrgParser m TodoMarker todoKeyword :: Monad m => OrgParser m TodoMarker
todoKeyword = try $ do todoKeyword = try $ do
taskStates <- activeTodoMarkers <$> getState taskStates <- activeTodoMarkers <$> getState
let kwParser tdm = try (tdm <$ string (todoMarkerName tdm) <* spaceChar) let kwParser tdm = try (tdm <$ string (todoMarkerName tdm)
<* spaceChar
<* updateLastPreCharPos)
choice (map kwParser taskStates) choice (map kwParser taskStates)
todoKeywordToInlines :: TodoMarker -> Inlines todoKeywordToInlines :: TodoMarker -> Inlines

View file

@ -87,6 +87,13 @@ tests =
let todoSpan = spanWith ("", ["done", "DONE"], []) "DONE" let todoSpan = spanWith ("", ["done", "DONE"], []) "DONE"
in headerWith ("header", [], []) 1 (todoSpan <> space <> "header") in headerWith ("header", [], []) 1 (todoSpan <> space <> "header")
, "emphasis in first word" =:
"** TODO /fix/ this" =?>
let todoSpan = spanWith ("", ["todo", "TODO"], []) "TODO"
in headerWith ("fix-this", [], [])
2
(todoSpan <> space <> emph "fix" <> space <> "this")
, "Header with unknown todo keyword" =: , "Header with unknown todo keyword" =:
"* WAITING header" =?> "* WAITING header" =?>
headerWith ("waiting-header", [], []) 1 "WAITING header" headerWith ("waiting-header", [], []) 1 "WAITING header"