aboutsummaryrefslogtreecommitdiff
path: root/html-test
diff options
context:
space:
mode:
authorŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-08-05 17:42:20 +0200
committerŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-08-22 23:40:26 +0200
commitb816a40ecb60ee04ab63558cd17373907e9bf4c4 (patch)
tree3d46321d419075eef4cc80089c9ac7ec938f40c4 /html-test
parent503e92e8e0d452c9eef30171f76f8f425912beef (diff)
Implement link-stripping logic as simple SYB transformation.
Diffstat (limited to 'html-test')
-rwxr-xr-xhtml-test/run.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/html-test/run.hs b/html-test/run.hs
index 87d53bab..f416f07c 100755
--- a/html-test/run.hs
+++ b/html-test/run.hs
@@ -7,6 +7,8 @@
import Control.Applicative
import Control.Monad
+import Data.Generics.Aliases
+import Data.Generics.Schemes
import Data.Maybe
import Data.List
@@ -264,7 +266,12 @@ deriving instance Eq Xml.CData
strip :: Xml.Element -> Xml.Element
-strip = id -- TODO.
+strip =
+ everywhere (mkT unlink)
+ where
+ unlink attr@(Xml.Attr { attrKey = key })
+ | Xml.qName key == "href" = attr { Xml.attrVal = "" }
+ | otherwise = attr
data Flag