diff options
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 12 | ||||
-rw-r--r-- | test/command/textcolor.md | 17 |
2 files changed, 26 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index a34be46e2..6b44df468 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -418,9 +418,15 @@ blockCommands = M.fromList $ blockTextcolor :: PandocMonad m => LP m Blocks blockTextcolor = do - skipopts - color <- braced - divWith ("",[],[("style","color: " ++ color)]) <$> grouped block <* notFollowedBy inline + skipopts + color <- braced + let constructor = divWith ("",[],[("style","color: " ++ color)]) + inlineContents <|> constructor <$> blockContents + where inlineContents = do + ils <- grouped inline + rest <- inlines + return (para (ils <> rest)) + blockContents = grouped block graphicsPath :: PandocMonad m => LP m Blocks graphicsPath = do diff --git a/test/command/textcolor.md b/test/command/textcolor.md index 59b0f6a16..47c41e62d 100644 --- a/test/command/textcolor.md +++ b/test/command/textcolor.md @@ -33,3 +33,20 @@ Hello \textcolor{blue}{\textbf{World}} [[Para [Str "Item",Space,Str "1"]] ,[Para [Str "Item",Space,Str "2"]]]]] ``` + +``` +% pandoc -f latex -t native +\textcolor{blue}{ +\begin{itemize} + \item Item 1 + \item Item 2 +\end{itemize} +} some more text +^D +[Div ("",[],[("style","color: blue")]) + [BulletList + [[Para [Str "Item",Space,Str "1"]] + ,[Para [Str "Item",Space,Str "2"]]]] +,Para [Str "some",Space,Str "more",Space,Str "text"]] +``` + |