aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-10-23 01:51:51 -0400
committerGitHub <noreply@github.com>2017-10-23 01:51:51 -0400
commitb4c6395001b747d713c9cb37a2eb4f8ef71f6e57 (patch)
tree8be05998c4f6625622aa4bb3da2dff05f5c5495c
parent33eff6904716509d291c06c56c7cea3697799395 (diff)
parente2123a4033ea9fc5c285f521883dfb65b721f069 (diff)
downloadpandoc-b4c6395001b747d713c9cb37a2eb4f8ef71f6e57.tar.gz
Merge pull request #3988 from mb21/lettrine
LaTeX Reader: support \lettrine
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs7
-rw-r--r--test/command/lettrine.md9
2 files changed, 13 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index 5ac114b19..a37c152d3 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -1264,6 +1264,7 @@ inlineCommands = M.union inlineLanguageCommands $ M.fromList $
, ("cref", rawInlineOr "cref" $ doref "ref") -- from cleveref.sty
, ("vref", rawInlineOr "vref" $ doref "ref+page") -- from varioref.sty
, ("eqref", rawInlineOr "eqref" $ doref "eqref") -- from amsmath.sty
+ , ("lettrine", optional opt >> extractSpaces (spanWith ("",["lettrine"],[])) <$> tok)
, ("(", mathInline . toksToString <$> manyTill anyTok (controlSeq ")"))
, ("[", mathDisplay . toksToString <$> manyTill anyTok (controlSeq "]"))
, ("ensuremath", mathInline . toksToString <$> braced)
@@ -1320,7 +1321,7 @@ inlineCommands = M.union inlineLanguageCommands $ M.fromList $
, ("i", lit "i")
, ("\\", linebreak <$ (do inTableCell <- sInTableCell <$> getState
guard $ not inTableCell
- optional (bracketed inline)
+ optional opt
spaces))
, (",", lit "\8198")
, ("@", pure mempty)
@@ -1750,7 +1751,7 @@ include = do
(Tok _ (CtrlSeq name) _) <-
controlSeq "include" <|> controlSeq "input" <|>
controlSeq "subfile" <|> controlSeq "usepackage"
- skipMany $ bracketed inline -- skip options
+ skipMany opt
fs <- (map (T.unpack . removeDoubleQuotes . T.strip) . T.splitOn "," .
untokenize) <$> braced
let fs' = if name == "usepackage"
@@ -2355,7 +2356,7 @@ hline = try $ do
controlSeq "endhead" <|>
controlSeq "endfirsthead"
spaces
- optional $ bracketed inline
+ optional opt
return ()
lbreak :: PandocMonad m => LP m Tok
diff --git a/test/command/lettrine.md b/test/command/lettrine.md
new file mode 100644
index 000000000..0c3c64d66
--- /dev/null
+++ b/test/command/lettrine.md
@@ -0,0 +1,9 @@
+```
+% pandoc -f latex -t native
+\lettrine{A}{category} is
+
+\lettrine[lhang=0.17]{A}{category} is
+^D
+[Para [Span ("",["lettrine"],[]) [Str "A"],Span ("",[],[]) [Str "category"],Space,Str "is"]
+,Para [Span ("",["lettrine"],[]) [Str "A"],Span ("",[],[]) [Str "category"],Space,Str "is"]]
+```