Add block version of \textcolor
This commit is contained in:
parent
49336ee6ee
commit
d9439808f2
2 changed files with 26 additions and 7 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -11,3 +11,14 @@
|
|||
^D
|
||||
[Para [Span ("",[],[("style","color: blue")]) [Str "Hello",Space,Strong [Str "World"]]]]
|
||||
```
|
||||
|
||||
```
|
||||
% pandoc -f latex -t native
|
||||
\textcolor{orange}{
|
||||
\begin{itemize}
|
||||
\item Test
|
||||
\end{itemize}
|
||||
}
|
||||
^D
|
||||
|
||||
```
|
||||
|
|
Loading…
Add table
Reference in a new issue