diff options
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 6252293d7..1c1aa4c62 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -393,6 +393,8 @@ blockCommands = M.fromList $ , ("graphicspath", graphicsPath) -- hyperlink , ("hypertarget", braced >> grouped block) + -- textcolor + , ("textcolor", blockTextcolor) ] ++ map ignoreBlocks -- these commands will be ignored unless --parse-raw is specified, -- in which case they will appear as raw latex blocks @@ -414,6 +416,12 @@ blockCommands = M.fromList $ , "pagebreak" ] +blockTextcolor :: PandocMonad m => LP m Blocks +blockTextcolor = do + skipopts + color <- braced + return <$> divWith ("",[],[("style","color: " ++ color)]) $ block + graphicsPath :: PandocMonad m => LP m Blocks graphicsPath = do ps <- bgroup *> (manyTill braced egroup) @@ -681,7 +689,7 @@ inlineCommands = M.fromList $ , ("textnhtt", ttfamily) , ("nhttfamily", ttfamily) -- textcolor - , ("textcolor", textcolor) + , ("textcolor", inlineTextcolor) ] ++ map ignoreInlines -- these commands will be ignored unless --parse-raw is specified, -- in which case they will appear as raw latex blocks: @@ -693,6 +701,12 @@ inlineCommands = M.fromList $ , "pagebreak" ] +inlineTextcolor :: PandocMonad m => LP m Inlines +inlineTextcolor = do + skipopts + color <- braced + spanWith ("",[],[("style","color: " ++ color)]) <$> tok + ttfamily :: PandocMonad m => LP m Inlines ttfamily = (code . stringify . toList) <$> tok @@ -758,12 +772,6 @@ dosiunitx = do emptyOr160 unit, unit] -textcolor :: PandocMonad m => LP m Inlines -textcolor = do - skipopts - color <- braced - spanWith ("",[],[("style","color: " ++ color)]) <$> tok - lit :: String -> LP m Inlines lit = pure . str |