From b816a40ecb60ee04ab63558cd17373907e9bf4c4 Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Wed, 5 Aug 2015 17:42:20 +0200 Subject: Implement link-stripping logic as simple SYB transformation. --- html-test/run.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3