From 8d7ecc27a19facf6c4b50a65ee1029c105aacdb2 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 20 Nov 2016 21:17:41 +0100 Subject: [PATCH] Allow beamer-style <...> options in raw LaTeX (also in Markdown). This allows use of things like `\only<2,3>{my content}` in Markdown that is going to be converted to beamer. Closes #3184. --- src/Text/Pandoc/Readers/LaTeX.hs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 882609a13..acd17bd2a 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -423,7 +423,8 @@ inlineCommand = try $ do star <- option "" (string "*") let name' = name ++ star let raw = do - rawargs <- withRaw (skipopts *> option "" dimenarg *> many braced) + rawargs <- withRaw + (skipangles *> skipopts *> option "" dimenarg *> many braced) let rawcommand = '\\' : name ++ star ++ snd rawargs transformed <- applyMacros' rawcommand if transformed /= rawcommand @@ -886,6 +887,17 @@ rawopt = do skipopts :: LP () skipopts = skipMany rawopt +-- opts in angle brackets are used in beamer +rawangle :: LP () +rawangle = try $ do + char '<' + skipMany (noneOf ">") + char '>' + return () + +skipangles :: LP () +skipangles = skipMany rawangle + inlineText :: LP Inlines inlineText = str <$> many1 inlineChar