diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-10-10 11:24:28 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-10-10 11:24:28 -0700 |
commit | c72277e98683544759d966fc88012b4f6d0fa8ec (patch) | |
tree | 19ba7d2508c838a012fc0a270bdf9fdb07d0e9cf | |
parent | 90106c300a424349f2be5787c82fd17ccf66983f (diff) | |
download | pandoc-c72277e98683544759d966fc88012b4f6d0fa8ec.tar.gz |
LaTeX reader: Properly handle `\^` followed by group closing.
Closes #7615.
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX/Inline.hs | 6 | ||||
-rw-r--r-- | test/command/7615.md | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX/Inline.hs b/src/Text/Pandoc/Readers/LaTeX/Inline.hs index 7b8bca4af..0fd14017b 100644 --- a/src/Text/Pandoc/Readers/LaTeX/Inline.hs +++ b/src/Text/Pandoc/Readers/LaTeX/Inline.hs @@ -35,7 +35,7 @@ import Text.Pandoc.Readers.LaTeX.Parsing import Text.Pandoc.Extensions (extensionEnabled, Extension(..)) import Text.Pandoc.Parsing (getOption, updateState, getState, notFollowedBy, manyTill, getInput, setInput, incSourceColumn, - option, many1, try) + option, many1) import Data.Char (isDigit) import Text.Pandoc.Highlighting (fromListingsLanguage,) import Data.Maybe (maybeToList, fromMaybe) @@ -160,8 +160,8 @@ romanNumeralArg = spaces *> (parser <|> inBraces) accentWith :: PandocMonad m => LP m Inlines -> Char -> Maybe Char -> LP m Inlines -accentWith tok combiningAccent fallBack = try $ do - ils <- tok +accentWith tok combiningAccent fallBack = do + ils <- option mempty tok case toList ils of (Str (T.uncons -> Just (x, xs)) : ys) -> return $ fromList $ -- try to normalize to the combined character: diff --git a/test/command/7615.md b/test/command/7615.md new file mode 100644 index 000000000..9235b0a17 --- /dev/null +++ b/test/command/7615.md @@ -0,0 +1,6 @@ +``` +% pandoc -f latex -t native +\texttt{\^} +^D +[ Para [ Code ( "" , [] , [] ) "^" ] ] +``` |