diff options
Diffstat (limited to 'plugins/ListLinksPlugin.hs')
-rw-r--r-- | plugins/ListLinksPlugin.hs | 15 |
1 files changed, 15 insertions, 0 deletions
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 = [] |