aboutsummaryrefslogtreecommitdiff
path: root/plugins/ListLinksPlugin.hs
blob: 88c1553b19bca570badbe971f1078200d4814c9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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                         = []