Skip to content

@btbytes /extracturls.hs
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
-- extracturls.hs
import Text.Pandoc
extractURL :: Inline -> [String]
extractURL (Link _ (u,_)) = [u]
extractURL (Image _ (u,_)) = [u]
extractURL _ = []
extractURLs :: Pandoc -> [String]
extractURLs = queryWith extractURL
readDoc :: String -> Pandoc
readDoc = readMarkdown defaultParserState
main :: IO ()
main = interact (unlines . extractURLs . readDoc)
cat foo.txt| runhaskell ./extracturls.hs | xargs -0 python -c "import sys,os; fnames=sys.argv[1].split(); foo=[fn for fn in fnames if not os.path.exists(fn)]; print 'missing files: \n%s' % ('\n'.join(foo),)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.