From e67ed9a76dcdf9d4d98659559ed108d1c6325d1d Mon Sep 17 00:00:00 2001 From: David Waern Date: Sun, 22 Nov 2009 14:48:47 +0000 Subject: Make copy.hs strip link contents before copying No more updating of reference files when URLs in links changes. --- tests/copy.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'tests/copy.hs') diff --git a/tests/copy.hs b/tests/copy.hs index d19dff7b..fa18fe9c 100644 --- a/tests/copy.hs +++ b/tests/copy.hs @@ -5,6 +5,8 @@ import System.Exit import System.Directory import Data.List import Control.Monad +import Text.Regex + main = do args <- getArgs @@ -13,11 +15,16 @@ main = do if not $ null args then mapM copy [ "output" file | file <- contents, ".html" `isSuffixOf` file, takeBaseName file `elem` args ] - else + else mapM copy [ "output" file | file <- contents, ".html" `isSuffixOf` file ] + copy file = do let new = "tests" takeFileName file <.> ".ref" - print file + print file print new - copyFile file ("tests" takeFileName file <.> ".ref") + contents <- readFile file + writeFile new (stripLinks contents) + + +stripLinks f = subRegex (mkRegexWithOpts "]*>" False False) f "" -- cgit v1.2.3