aboutsummaryrefslogtreecommitdiff
path: root/plugins/ListLinksPlugin.hs
blob: 1342aecf0069fb643f9850607a16edc9bbe35b8f (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 = queryWith findURLs p
  putStrLn $ unlines urls
  return $ Pandoc (Meta [] [] []) []

findURLs :: Inline -> [String]
findURLs (Link label (url, title)) = [url]
findURLs x                         = []