aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-04-07 09:24:26 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-04-07 09:25:52 -0700
commit11df2a3c0f2b1b8e351ad8caaa7cdf583e1b3b2e (patch)
tree38ccac520532c8db49bab1a2c0129c36ef883b06 /src/Text/Pandoc
parent39b742e5ba19641d125c2071b99e74c6a61596b1 (diff)
downloadpandoc-11df2a3c0f2b1b8e351ad8caaa7cdf583e1b3b2e.tar.gz
LaTeX reader: better handling of `\lettrine`.
- SmallCaps instead of Span for the part after the initial capital. - Ensure that both arguments are parsed, so that in Markdown both are treated as raw LateX. (Closes #6258.)
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index 59339c606..038430f99 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -923,7 +923,7 @@ inlineCommands = M.union inlineLanguageCommands $ M.fromList
, ("eqref", rawInlineOr "eqref" $ doref "eqref") -- from amsmath.sty
, ("mbox", rawInlineOr "mbox" $ processHBox <$> tok)
, ("hbox", rawInlineOr "hbox" $ processHBox <$> tok)
- , ("lettrine", optional opt >> extractSpaces (spanWith ("",["lettrine"],[])) <$> tok)
+ , ("lettrine", rawInlineOr "lettrine" $ lettrine)
, ("(", mathInline . untokenize <$> manyTill anyTok (controlSeq ")"))
, ("[", mathDisplay . untokenize <$> manyTill anyTok (controlSeq "]"))
, ("ensuremath", mathInline . untokenize <$> braced)
@@ -1178,6 +1178,13 @@ inlineCommands = M.union inlineLanguageCommands $ M.fromList
, ("ifdim", ifdim)
]
+lettrine :: PandocMonad m => LP m Inlines
+lettrine = do
+ optional opt
+ x <- tok
+ y <- tok
+ return $ extractSpaces (spanWith ("",["lettrine"],[])) x <> smallcaps y
+
ifdim :: PandocMonad m => LP m Inlines
ifdim = do
contents <- manyTill anyTok (controlSeq "fi")