From 874c3e0deabab154548a3e91e271e86e94ba8502 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sat, 24 Jan 2009 19:58:06 +0000 Subject: Added a plugin system, based on hint. + In Text.Pandoc.Definition, added processIn, processInM, and queryIn, and deprecated processPandoc and queryPandoc for these more general functions, which are useful in writing plugins. + Added module Text.Pandoc.Plugins. + Added a --plugins option to Main, and code to run the parsed pandoc document through all the plugins. + Provided five sample plugin files in the plugins/ directory. + Documented --plugin in the pandoc man page and README. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1519 788f1e2b-df1e-0410-8736-df70ead52e1b --- plugins/ListLinksPlugin.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 plugins/ListLinksPlugin.hs (limited to 'plugins/ListLinksPlugin.hs') diff --git a/plugins/ListLinksPlugin.hs b/plugins/ListLinksPlugin.hs new file mode 100644 index 000000000..88c1553b1 --- /dev/null +++ b/plugins/ListLinksPlugin.hs @@ -0,0 +1,15 @@ +module ListLinksPlugin (transform) where +import Text.Pandoc + +-- This plugin returns an empty document and prints a list +-- of the URLs linked to in the source document. + +transform :: Pandoc -> IO Pandoc +transform p = do + let urls = queryIn findURLs p + putStrLn $ unlines urls + return $ Pandoc (Meta [] [] []) [] + +findURLs :: Inline -> [String] +findURLs (Link label (url, title)) = [url] +findURLs x = [] -- cgit v1.2.3