aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-01-10 08:26:33 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2020-01-10 08:26:33 -0800
commit42b915e65624df9f910769604889a3c1c9fc6845 (patch)
tree510ad0b6e5831844ada4f1cd044304a2ad3105f8 /src/Text/Pandoc
parent6cf7a9cd8e7ca2788b7da52c331e23e4bb6eba5b (diff)
downloadpandoc-42b915e65624df9f910769604889a3c1c9fc6845.tar.gz
LaTeX reader: allow beamer overlays for all commands in all raw tex.
This affecs parsing of raw tex in LaTeX and in Markdown and other formats. Closes #6043.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index bfade7284..c7c778193 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -773,7 +773,8 @@ inlineCommand' = try $ do
Tok _ (CtrlSeq name) cmd <- anyControlSeq
guard $ name /= "begin" && name /= "end"
star <- option "" ("*" <$ symbol '*' <* optional sp)
- let name' = name <> star
+ overlay <- option "" overlaySpecification
+ let name' = name <> star <> overlay
let names = ordNub [name', name] -- check non-starred as fallback
let raw = do
guard $ isInlineCommand name || not (isBlockCommand name)
@@ -802,19 +803,18 @@ rawopt = try $ do
return $ "[" <> inner <> "]"
skipopts :: PandocMonad m => LP m ()
-skipopts = skipMany (overlaySpecification <|> void rawopt)
+skipopts = skipMany (void overlaySpecification <|> void rawopt)
-- opts in angle brackets are used in beamer
-overlaySpecification :: PandocMonad m => LP m ()
+overlaySpecification :: PandocMonad m => LP m Text
overlaySpecification = try $ do
symbol '<'
- ts <- manyTill overlayTok (symbol '>')
- guard $ case ts of
- -- see issue #3368
- [Tok _ Word s] | T.all isLetter s -> s `elem`
- ["beamer","presentation", "trans",
- "handout","article", "second"]
- _ -> True
+ t <- untokenize <$> manyTill overlayTok (symbol '>')
+ -- see issue #3368
+ guard $ not (T.all isLetter t) ||
+ t `elem` ["beamer","presentation", "trans",
+ "handout","article", "second"]
+ return $ "<" <> t <> ">"
overlayTok :: PandocMonad m => LP m Tok
overlayTok =