mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-25 17:05:41 +00:00
Org reader: allow multi-word arguments to src block params
The reader now correctly parses src block parameter list even if parameter arguments contain multiple words. Closes: #3477
This commit is contained in:
@@ -589,9 +589,12 @@ blockOption = try $ do
|
||||
orgParamValue :: Monad m => OrgParser m String
|
||||
orgParamValue = try $
|
||||
skipSpaces
|
||||
*> notFollowedBy (char ':' )
|
||||
*> many1 nonspaceChar
|
||||
*> notFollowedBy orgArgKey
|
||||
*> noneOf "\n\r" `many1Till` endOfValue
|
||||
<* skipSpaces
|
||||
where
|
||||
endOfValue = lookAhead $ (try $ skipSpaces <* oneOf "\n\r")
|
||||
<|> (try $ skipSpaces1 <* orgArgKey)
|
||||
|
||||
|
||||
--
|
||||
|
||||
@@ -1559,6 +1559,15 @@ tests =
|
||||
params = [ ("data-org-language", "sh"), ("startFrom", "10") ]
|
||||
in codeBlockWith ("", classes, params) ":() { :|:& };:\n"
|
||||
|
||||
, "Source block with multi-word parameter values" =:
|
||||
unlines [ "#+BEGIN_SRC dot :cmdline -Kdot -Tpng "
|
||||
, "digraph { id [label=\"ID\"] }"
|
||||
, "#+END_SRC"
|
||||
] =?>
|
||||
let classes = [ "dot" ]
|
||||
params = [ ("cmdline", "-Kdot -Tpng") ]
|
||||
in codeBlockWith ("", classes, params) "digraph { id [label=\"ID\"] }\n"
|
||||
|
||||
, "Example block" =:
|
||||
unlines [ "#+begin_example"
|
||||
, "A chosen representation of"
|
||||
|
||||
Reference in New Issue
Block a user