diff options
author | John MacFarlane <jgm@berkeley.edu> | 2020-11-20 13:39:00 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2020-11-20 13:40:26 -0800 |
commit | 9a4097640f052468054105cde8ef342ac8a1db30 (patch) | |
tree | 5318d7e588b1b7867c280fd8088aeee3346edbb5 | |
parent | 797db8d30631cbd704575ee11d3bdda5bf57270f (diff) | |
download | pandoc-9a4097640f052468054105cde8ef342ac8a1db30.tar.gz |
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.
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 4 | ||||
-rw-r--r-- | test/command/6869.md | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 61c9abe3a..2ec191154 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -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 diff --git a/test/command/6869.md b/test/command/6869.md new file mode 100644 index 000000000..cd8ff9ff4 --- /dev/null +++ b/test/command/6869.md @@ -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}"]]] +``` |