Created
December 17, 2011 20:09
-
-
Save btbytes/1491227 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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