Parse empty argument array in inline src blocks.
`enclosedByPair` alone does not the handle the empty array properly since it uses `many1Till`.
This commit is contained in:
parent
c07b9aebc2
commit
4f9ab7e032
2 changed files with 9 additions and 1 deletions
|
@ -525,7 +525,8 @@ inlineCodeBlock :: PandocMonad m => OrgParser m (F Inlines)
|
|||
inlineCodeBlock = try $ do
|
||||
string "src_"
|
||||
lang <- many1 orgArgWordChar
|
||||
opts <- option [] $ enclosedByPair '[' ']' inlineBlockOption
|
||||
opts <- option [] $ try (enclosedByPair '[' ']' inlineBlockOption)
|
||||
<|> (mempty <$ string "[]")
|
||||
inlineCode <- enclosedByPair '{' '}' (noneOf "\n\r")
|
||||
let attrClasses = [translateLang lang]
|
||||
let attrKeyVal = originalLang lang <> opts
|
||||
|
|
|
@ -280,6 +280,13 @@ tests =
|
|||
)
|
||||
"echo 'Hello, World'")
|
||||
|
||||
, "Inline code block with a blank argument array" =:
|
||||
"src_sh[]{echo 'Hello, World'}" =?>
|
||||
para (codeWith ( ""
|
||||
, [ "bash" ]
|
||||
, [ ("org-language", "sh") ])
|
||||
"echo 'Hello, World'")
|
||||
|
||||
, "Inline code block with toggle" =:
|
||||
"src_sh[:toggle]{echo $HOME}" =?>
|
||||
para (codeWith ( ""
|
||||
|
|
Loading…
Reference in a new issue