From 4fb9976a9a9589799d66fe8df91128b8fb19d18f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 27 Feb 2017 00:40:33 +0100 Subject: Minor cleanups in LaTeX reader. --- src/Text/Pandoc/Readers/LaTeX.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/Text/Pandoc/Readers') 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 -- cgit v1.2.3