From 42b915e65624df9f910769604889a3c1c9fc6845 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 10 Jan 2020 08:26:33 -0800 Subject: 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. --- src/Text/Pandoc/Readers/LaTeX.hs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/Text/Pandoc') 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 = -- cgit v1.2.3