aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Gibb <[email protected]>2025-07-24 21:40:08 +0100
committerGitHub <[email protected]>2025-07-24 22:40:08 +0200
commitb84fa66fcb8d080086b36a250ac1c76873c69e92 (patch)
treed60c4c1ce74801297895686c2a935a20dc528bad
parentf000fa168bd122fee6e67f5a67bdd6d42d173261 (diff)
Org reader: Recognize "fast access" characters in TODO state definitions (#10990)
-rw-r--r--src/Text/Pandoc/Readers/Org/Meta.hs6
-rw-r--r--test/Tests/Readers/Org/Block/Header.hs7
2 files changed, 12 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Org/Meta.hs b/src/Text/Pandoc/Readers/Org/Meta.hs
index 6246947e4..8f19760bc 100644
--- a/src/Text/Pandoc/Readers/Org/Meta.hs
+++ b/src/Text/Pandoc/Readers/Org/Meta.hs
@@ -252,7 +252,11 @@ todoSequence = try $ do
where
todoKeyword :: Monad m => OrgParser m Text
- todoKeyword = many1Char nonspaceChar <* skipSpaces
+ todoKeyword = do
+ keyword <- many1Char nonspaceChar
+ let cleanKeyword = T.takeWhile (/= '(') keyword
+ skipSpaces
+ return cleanKeyword
todoKeywords :: Monad m => OrgParser m [Text]
todoKeywords = try $
diff --git a/test/Tests/Readers/Org/Block/Header.hs b/test/Tests/Readers/Org/Block/Header.hs
index f0d77bc94..52396b905 100644
--- a/test/Tests/Readers/Org/Block/Header.hs
+++ b/test/Tests/Readers/Org/Block/Header.hs
@@ -118,6 +118,13 @@ tests =
in headerWith ("compile", [], []) 1 (waiting <> space <> "compile")
<> headerWith ("lunch", [], []) 1 (cancelled <> space <> "lunch")
<> headerWith ("todo-feature", [], []) 1 (done <> space <> "todo-feature")
+
+ , "Fast access TODO states" =:
+ T.unlines [ "#+TODO: TODO(t) | DONE(d)"
+ , "* TODO test"
+ ] =?>
+ let todoSpan = spanWith ("", ["todo", "TODO"], []) "TODO"
+ in headerWith ("test", [], []) 1 (todoSpan <> space <> "test")
]
, "Tagged headers" =: