diff options
author | John MacFarlane <jgm@berkeley.edu> | 2010-03-20 14:35:14 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2010-03-20 14:35:14 -0700 |
commit | 5a24e1371da58a5f8f02718944809637420c370a (patch) | |
tree | 4bbeb1bf7fab3c7e2556a0c72e253c7e8df38fee /plugins/DotPlugin.hs | |
parent | b5e58b2a5fe77964e4e4f721e8e69add5ce8dcb9 (diff) | |
download | pandoc-5a24e1371da58a5f8f02718944809637420c370a.tar.gz |
Removed 'plugins' directory.
Diffstat (limited to 'plugins/DotPlugin.hs')
-rw-r--r-- | plugins/DotPlugin.hs | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/plugins/DotPlugin.hs b/plugins/DotPlugin.hs deleted file mode 100644 index db1a02e1c..000000000 --- a/plugins/DotPlugin.hs +++ /dev/null @@ -1,30 +0,0 @@ -module DotPlugin (transform) where -import Text.Pandoc -import Text.Pandoc.Shared -import System.Process (readProcess) -import Data.Char (ord) --- from the utf8-string package on HackageDB: -import Data.ByteString.Lazy.UTF8 (fromString) --- from the SHA package on HackageDB: -import Data.Digest.Pure.SHA - --- This plugin allows you to include a graphviz "dot" diagram --- in a document like this: --- --- ~~~ {.dot name="diagram1"} --- digraph G {Hello->World} --- ~~~ - -transform :: Block -> IO Block -transform (CodeBlock (id, classes, namevals) contents) | "dot" `elem` classes = do - let (name, outfile) = case lookup "name" namevals of - Just fn -> ([Str fn], fn ++ ".png") - Nothing -> ([], uniqueName contents ++ ".png") - result <- readProcess "dot" ["-Tpng"] contents - writeFile outfile result - return $ Para [Image name (outfile, "")] -transform x = return x - --- | Generate a unique filename given the file's contents. -uniqueName :: String -> String -uniqueName = showDigest . sha1 . fromString |