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.
This commit is contained in:
John MacFarlane 2020-01-10 08:26:33 -08:00
parent 6cf7a9cd8e
commit 42b915e656
2 changed files with 18 additions and 10 deletions

View file

@ -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 =

8
test/command/6043.md Normal file
View file

@ -0,0 +1,8 @@
```
% pandoc -t beamer
\textbf<1>{Bold Text On Slide1}
^D
\begin{frame}
\textbf<1>{Bold Text On Slide1}
\end{frame}
```