summaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-10-11 21:21:09 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-10-11 21:21:09 -0700
commit40128754ab20105bce68cd072607f8877f10dca1 (patch)
treeb8f3ce51ee116580ab769035b6a4b4aa4c0c84f5 /src/Text
parentcfc2e00b849f3d40a78eaa0ba0a44545a57ca56a (diff)
LaTeX reader: Made rawLaTeXInline more flexible.
Now it will also try to parse block commands. This is usually what we want, given how rawLaTeXInline is used in the markdown and textile readers. If a block-level LaTeX command is used in the middle of a paragraph (e.g. `\subtitle` inside a title), we can treat it as raw inline LaTeX.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index c31266ea3..bdbf8f100 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -717,10 +717,8 @@ rawLaTeXBlock = snd <$> try (withRaw (environment <|> blockCommand))
rawLaTeXInline :: Parser [Char] ParserState Inline
rawLaTeXInline = do
- (res, raw) <- withRaw inlineCommand
- if res == mempty
- then return (Str "")
- else RawInline "latex" <$> (applyMacros' raw)
+ raw <- (snd <$> withRaw inlineCommand) <|> (snd <$> withRaw blockCommand)
+ RawInline "latex" <$> applyMacros' raw
environments :: M.Map String (LP Blocks)
environments = M.fromList