aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pandoc.cabal6
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs23
2 files changed, 16 insertions, 13 deletions
diff --git a/pandoc.cabal b/pandoc.cabal
index 9679c99ff..160f864ad 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -193,7 +193,7 @@ Library
Build-Depends: containers >= 0.1 && < 0.5,
parsec >= 3.1 && < 3.2,
blaze-html >= 0.4.3.0 && < 0.5,
- mtl >= 1.1 && < 2.1,
+ mtl >= 1.1 && < 2.2,
network >= 2 && < 2.4,
filepath >= 1.1 && < 1.4,
process >= 1 && < 1.2,
@@ -292,7 +292,7 @@ Executable pandoc
Build-Depends: containers >= 0.1 && < 0.5,
parsec >= 3.1 && < 3.2,
blaze-html >= 0.4.3.0 && < 0.5,
- mtl >= 1.1 && < 2.1,
+ mtl >= 1.1 && < 2.2,
network >= 2 && < 2.4,
filepath >= 1.1 && < 1.4,
process >= 1 && < 1.2,
@@ -350,7 +350,7 @@ Executable test-pandoc
Build-Depends: containers >= 0.1 && < 0.5,
parsec >= 3.1 && < 3.2,
blaze-html >= 0.4.3.0 && < 0.5,
- mtl >= 1.1 && < 2.1,
+ mtl >= 1.1 && < 2.2,
network >= 2 && < 2.4,
filepath >= 1.1 && < 1.4,
process >= 1 && < 1.2,
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index 2ea2b2da3..c0b224aaf 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -321,16 +321,19 @@ inlineCommand = try $ do
parseRaw <- stateParseRaw `fmap` getState
star <- option "" (string "*")
let name' = name ++ star
+ let rawargs = withRaw (skipopts *> option "" dimenarg
+ *> many braced) >>= applyMacros' . snd
+ let raw = if parseRaw
+ then (rawInline "latex" . (('\\':name') ++)) <$> rawargs
+ else mempty <$> rawargs
case M.lookup name' inlineCommands of
- Just p -> p
+ Just p -> p <|> raw
Nothing -> case M.lookup name inlineCommands of
- Just p -> p
- Nothing ->
- if parseRaw
- then (rawInline "latex" . (('\\':name') ++)) <$> rawargs
- else mempty <$> rawargs
- where rawargs = withRaw (skipopts *> option "" dimenarg
- *> many braced) >>= applyMacros' . snd
+ Just p -> p <|> raw
+ Nothing -> raw
+
+unlessParseRaw :: LP ()
+unlessParseRaw = getState >>= guard . not . stateParseRaw
isBlockCommand :: String -> Bool
isBlockCommand s = maybe False (const True) $ M.lookup s blockCommands
@@ -350,8 +353,8 @@ inlineCommands = M.fromList $
, ("dots", lit "…")
, ("mdots", lit "…")
, ("sim", lit "~")
- , ("label", inBrackets <$> tok)
- , ("ref", inBrackets <$> tok)
+ , ("label", unlessParseRaw >> (inBrackets <$> tok))
+ , ("ref", unlessParseRaw >> (inBrackets <$> tok))
, ("(", mathInline $ manyTill anyChar (try $ string "\\)"))
, ("[", mathDisplay $ manyTill anyChar (try $ string "\\]"))
, ("ensuremath", mathInline $ braced)