@@ -1204,16 +1204,28 @@ rawopt = do
12041204 return $ "[" <> inner <> "]"
12051205
12061206skipopts :: PandocMonad m => LP m ()
1207−skipopts = skipMany rawopt
1207+skipopts = skipMany (overlaySpecification <|> void rawopt)
12081208
12091209-- opts in angle brackets are used in beamer
1210−rawangle :: PandocMonad m => LP m ()
1211−rawangle = try $ do
1210+overlaySpecification :: PandocMonad m => LP m ()
1211+overlaySpecification = try $ do
12121212 symbol '<'
1213− () <$ manyTill anyTok (symbol '>')
1214−
1215−skipangles :: PandocMonad m => LP m ()
1216−skipangles = skipMany rawangle
1213+ ts <- manyTill overlayTok (symbol '>')
1214+ guard $ case ts of
1215+ -- see issue #3368
1216+ [Tok _ Word s] | T.all isLetter s -> s `elem`
1217+ ["beamer","presentation", "trans",
1218+ "handout","article", "second"]
1219+ _ -> True
1220+
1221+overlayTok :: PandocMonad m => LP m Tok
1222+overlayTok =
1223+ satisfyTok (\t ->
1224+ case t of
1225+ Tok _ Word _ -> True
1226+ Tok _ Spaces _ -> True
1227+ Tok _ Symbol c -> c `elem` ["-","+","@","|",":",","]
1228+ _ -> False)
12171229
12181230ignore :: (Monoid a, PandocMonad m) => String -> ParserT s u m a
12191231ignore raw = do
@@ -1289,7 +1301,7 @@ inlineCommands = M.union inlineLanguageCommands $ M.fromList
12891301 , ("textup", extractSpaces (spanWith ("",["upright"],[])) <$> tok)
12901302 , ("texttt", ttfamily)
12911303 , ("sout", extractSpaces strikeout <$> tok)
1292− , ("alert", skipangles >> spanWith ("",["alert"],[]) <$> tok) -- beamer
1304+ , ("alert", skipopts >> spanWith ("",["alert"],[]) <$> tok) -- beamer
12931305 , ("lq", return (str "‘"))
12941306 , ("rq", return (str "’"))
12951307 , ("textquoteleft", return (str "‘"))
@@ -1765,7 +1777,6 @@ getRawCommand name txt = do
17651777 "def" ->
17661778 void $ manyTill anyTok braced
17671779 _ -> do
1768− skipangles
17691780 skipopts
17701781 option "" (try (optional sp *> dimenarg))
17711782 void $ many braced