diff options
-rw-r--r-- | tests/copy.hs | 13 |
1 files changed, 10 insertions, 3 deletions
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 "<A HREF=[^>]*>" False False) f "<A HREF=\"\">" |