Created
December 4, 2011 21:56
-
-
Save jgm/1431411 to your computer and use it in GitHub Desktop.
shell for script to turn pandoc math to svg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- math2svg.hs | |
-- compile with: | |
-- ghc --make math2svg.hs | |
-- run using: | |
-- pandoc -t json -s | ./math2svg | pandoc -f json | |
import Text.Pandoc | |
import Text.JSON.Generic | |
main = getContents >>= transform . decodeJSON >>= putStrLn . encodeJSON | |
transform :: Pandoc -> IO Pandoc | |
transform = bottomUpM mathToSvg | |
mathToSvg :: Inline -> IO Inline | |
mathToSvg (Math mathType x) = do | |
svg <- -- (CODE TO CONVERT x to SVG tag) | |
return (RawInline "html" svg) | |
mathToSvg x = return x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment