aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorMarc Schreiber <marc.schreiber@fh-aachen.de>2017-05-03 12:00:30 +0200
committerMarc Schreiber <marc.schreiber@fh-aachen.de>2017-05-03 12:00:30 +0200
commitd9439808f2fe226aad027c8c9d0a38217a1e8c34 (patch)
tree5835a79f5591205d0d2b7e6d36b2b8f87394adc2 /src/Text
parent49336ee6eeecc352e248d1262ea1b46070e00243 (diff)
downloadpandoc-d9439808f2fe226aad027c8c9d0a38217a1e8c34.tar.gz
Add block version of \textcolor
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs22
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