diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-10-23 01:51:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-23 01:51:51 -0400 |
commit | b4c6395001b747d713c9cb37a2eb4f8ef71f6e57 (patch) | |
tree | 8be05998c4f6625622aa4bb3da2dff05f5c5495c | |
parent | 33eff6904716509d291c06c56c7cea3697799395 (diff) | |
parent | e2123a4033ea9fc5c285f521883dfb65b721f069 (diff) | |
download | pandoc-b4c6395001b747d713c9cb37a2eb4f8ef71f6e57.tar.gz |
Merge pull request #3988 from mb21/lettrine
LaTeX Reader: support \lettrine
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 7 | ||||
-rw-r--r-- | test/command/lettrine.md | 9 |
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"]] +``` |