summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-02-27 00:40:33 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-02-27 00:40:33 +0100
commit4fb9976a9a9589799d66fe8df91128b8fb19d18f (patch)
treee0d940b7792d2e78e30dcdf7e46e2b8f5090a0c9 /src
parent99b39ffc1726a86e6a6ad45ef6b81a28b46594ef (diff)
Minor cleanups in LaTeX reader.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index 18c240e27..bbbd1fee0 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -445,22 +445,22 @@ inlineCommand :: PandocMonad m => LP m Inlines
inlineCommand = try $ do
(name, raw') <- withRaw anyControlSeq
guard $ name /= "begin" && name /= "end"
- exts <- getOption readerExtensions
star <- option "" (string "*")
let name' = name ++ star
let raw = do
+ guard $ not (isBlockCommand name)
rawargs <- withRaw
- (skipangles *> skipopts *> option "" dimenarg *> many braced)
+ (skipangles *> skipopts *> option "" dimenarg *> many braced)
let rawcommand = raw' ++ star ++ snd rawargs
transformed <- applyMacros' rawcommand
+ exts <- getOption readerExtensions
if transformed /= rawcommand
then parseFromString inlines transformed
else if extensionEnabled Ext_raw_tex exts
then return $ rawInline "latex" rawcommand
else ignore rawcommand
- (lookupListDefault mzero [name',name] inlineCommands <*
+ (lookupListDefault raw [name',name] inlineCommands <*
optional (try (string "{}")))
- <|> (guard (not (isBlockCommand name)) >> raw)
unlessParseRaw :: PandocMonad m => LP m ()
unlessParseRaw = getOption readerExtensions >>=
@@ -508,7 +508,6 @@ inlineCommands = M.fromList $
, ("sim", lit "~")
, ("label", unlessParseRaw >> (inBrackets <$> tok))
, ("ref", unlessParseRaw >> (inBrackets <$> tok))
- , ("noindent", unlessParseRaw >> ignore "noindent")
, ("textgreek", tok)
, ("sep", lit ",")
, ("cref", unlessParseRaw >> (inBrackets <$> tok)) -- from cleveref.sty