git.iko.soy/typeable/pandoc
on master help sign in
Removed 'plugins' directory.
commit5a24e1371da58a5f8f02718944809637420c370a authorJohn MacFarlane <jgm@berkeley.edu> dateSat 20 Mar 2010, 14:35 (17 years ago) parentb5e58b2
5 files changed−88
plugins/CapitalizeEmphasisPlugin.hs−14 plugins/DotPlugin.hs−30 plugins/IncludeFilePlugin.hs−19 plugins/ListLinksPlugin.hs−15 plugins/WordPressPlugin.hs−10
plugins/CapitalizeEmphasisPlugin.hsdeleted−14
@@ -1,14 +0,0 @@
1−module CapitalizeEmphasisPlugin (transform) where
2−import Text.Pandoc
3−import Data.Char (toUpper)
4−
5−-- This plugin changes emphasized text into CAPITALIZED TEXT.
6−
7−transform :: [Inline] -> [Inline]
8−transform (Emph x : ys) = processWith capStr x ++ transform ys
9−transform (x : ys) = x : transform ys
10−transform [] = []
11−
12−capStr :: Inline -> Inline
13−capStr (Str x) = Str (map toUpper x)
14−capStr x = x
plugins/DotPlugin.hsdeleted−30
@@ -1,30 +0,0 @@
1−module DotPlugin (transform) where
2−import Text.Pandoc
3−import Text.Pandoc.Shared
4−import System.Process (readProcess)
5−import Data.Char (ord)
6−-- from the utf8-string package on HackageDB:
7−import Data.ByteString.Lazy.UTF8 (fromString)
8−-- from the SHA package on HackageDB:
9−import Data.Digest.Pure.SHA
10−
11−-- This plugin allows you to include a graphviz "dot" diagram
12−-- in a document like this:
13−--
14−-- ~~~ {.dot name="diagram1"}
15−-- digraph G {Hello->World}
16−-- ~~~
17−
18−transform :: Block -> IO Block
19−transform (CodeBlock (id, classes, namevals) contents) | "dot" `elem` classes = do
20− let (name, outfile) = case lookup "name" namevals of
21− Just fn -> ([Str fn], fn ++ ".png")
22− Nothing -> ([], uniqueName contents ++ ".png")
23− result <- readProcess "dot" ["-Tpng"] contents
24− writeFile outfile result
25− return $ Para [Image name (outfile, "")]
26−transform x = return x
27−
28−-- | Generate a unique filename given the file's contents.
29−uniqueName :: String -> String
30−uniqueName = showDigest . sha1 . fromString
plugins/IncludeFilePlugin.hsdeleted−19
@@ -1,19 +0,0 @@
1−module IncludeFilePlugin (transform) where
2−import Text.Pandoc
3−import Text.Pandoc.Shared
4−import Control.Monad
5−
6−-- This plugin allows you to include the contents of an
7−-- external file in a delimited code block like this:
8−--
9−-- ~~~ {include="filename"}
10−-- ~~~
11−--
12−-- Trailing newlines are trimmed.
13−
14−transform :: Block -> IO Block
15−transform cb@(CodeBlock (id, classes, namevals) contents) =
16− case lookup "include" namevals of
17− Just f -> return . (CodeBlock (id, classes, namevals) . stripTrailingNewlines) =<< readFile f
18− Nothing -> return cb
19−transform x = return x
plugins/ListLinksPlugin.hsdeleted−15
@@ -1,15 +0,0 @@
1−module ListLinksPlugin (transform) where
2−import Text.Pandoc
3−
4−-- This plugin returns an empty document and prints a list
5−-- of the URLs linked to in the source document.
6−
7−transform :: Pandoc -> IO Pandoc
8−transform p = do
9− let urls = queryWith findURLs p
10− putStrLn $ unlines urls
11− return $ Pandoc (Meta [] [] []) []
12−
13−findURLs :: Inline -> [String]
14−findURLs (Link label (url, title)) = [url]
15−findURLs x = []
plugins/WordPressPlugin.hsdeleted−10
@@ -1,10 +0,0 @@
1−module WordPressPlugin (transform) where
2−import Text.Pandoc
3−
4−-- This plugin (when used with -m) prints LaTeX math in the
5−-- format required by WordPress blogs. $e=mc^2$ becomes
6−-- $LaTeX e=mc^2$.
7−
8−transform :: Inline -> Inline
9−transform (Math x y) = Math x $ "LaTeX " ++ y
10−transform x = x