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:
Albert Krewinkel
2017-04-23 13:58:16 +02:00
parent 2e43e27e5c
commit 04cb602d79
2 changed files with 14 additions and 2 deletions
+5 -2
View File
@@ -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)
--
+9
View File
@@ -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"