Improve LaTeX option parsing...

in cases where we run into trouble parsing inlines til the
closing `]`, e.g. quotes, we return a plain string with the
option contents. Previously we mistakenly included the brackets
in this string.

Closes #6869.
This commit is contained in:
John MacFarlane 2020-11-20 13:39:00 -08:00
parent 797db8d306
commit 9a4097640f
2 changed files with 9 additions and 1 deletions

View file

@ -559,7 +559,9 @@ tok = try $ spaces >> grouped inline <|> inlineCommand' <|> singleChar'
return $ str t
opt :: PandocMonad m => LP m Inlines
opt = bracketed inline <|> (str <$> rawopt)
opt = bracketed inline
<|>
(str . T.dropWhile (=='[') . T.dropWhileEnd (==']') <$> rawopt)
paropt :: PandocMonad m => LP m Inlines
paropt = parenWrapped inline

6
test/command/6869.md Normal file
View file

@ -0,0 +1,6 @@
```
% pandoc -f latex -t native
\cite[„Aber“]{key}
^D
[Para [Cite [Citation {citationId = "key", citationPrefix = [], citationSuffix = [Str "\8222Aber\8220"], citationMode = NormalCitation, citationNoteNum = 0, citationHash = 0}] [RawInline (Format "latex") "\\cite[\8222Aber\8220]{key}"]]]
```