diff options
author | David Waern <david.waern@gmail.com> | 2011-11-25 00:03:33 +0100 |
---|---|---|
committer | David Waern <david.waern@gmail.com> | 2011-11-25 00:03:33 +0100 |
commit | 626211cc85d70918c0c02328084dcee50a206086 (patch) | |
tree | 61fdb772a0293bfce7a7d0bd3cd58aecaf7568bc /tests | |
parent | 4d457ae5f906052b67e4339dde6e828f1f9044cb (diff) |
Avoid depency on regex-compat also in accept.hs.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/html-tests/accept.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/html-tests/accept.hs b/tests/html-tests/accept.hs index fa18fe9c..fe1e5422 100644 --- a/tests/html-tests/accept.hs +++ b/tests/html-tests/accept.hs @@ -5,7 +5,6 @@ import System.Exit import System.Directory import Data.List import Control.Monad -import Text.Regex main = do @@ -27,4 +26,11 @@ copy file = do writeFile new (stripLinks contents) -stripLinks f = subRegex (mkRegexWithOpts "<A HREF=[^>]*>" False False) f "<A HREF=\"\">" +stripLinks str = + let prefix = "<a href=\"" in + case stripPrefix prefix str of + Just str' -> prefix ++ stripLinks (dropWhile (/= '"') str') + Nothing -> + case str of + [] -> [] + x : xs -> x : stripLinks xs |