aboutsummaryrefslogtreecommitdiff
path: root/tests/html-tests/copy.hs
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2011-11-25 02:16:20 +0100
committerDavid Waern <david.waern@gmail.com>2011-11-25 02:16:20 +0100
commit3bdd9282ce67d1094c36204e77e3f32356a2c059 (patch)
treee8c57a5d9c5658d63297f0ab4616857d51243ab6 /tests/html-tests/copy.hs
parent672ab6384a0dbec0f5a09ca7d5437f28aa21c5fe (diff)
Some more changes to test scripts.
Diffstat (limited to 'tests/html-tests/copy.hs')
-rw-r--r--tests/html-tests/copy.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/html-tests/copy.hs b/tests/html-tests/copy.hs
index fa18fe9c..fe1e5422 100644
--- a/tests/html-tests/copy.hs
+++ b/tests/html-tests/copy.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