summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-11-20 21:17:41 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2016-11-20 21:17:41 +0100
commit8d7ecc27a19facf6c4b50a65ee1029c105aacdb2 (patch)
treee76f6a0749cd50d3a5cef9fcd7a3e386a7d8afeb
parentbd1917602658467ca2335244ea97f0b39f4f680a (diff)
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.
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs14
1 files changed, 13 insertions, 1 deletions
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