-- | sanitize a tag and attributes using two custom filters.
sanitizeWith
  :: (Text -> Bool)                             -- ^ The tag name sanitizer.
  -> (Attribute Text -> Maybe (Attribute Text)) -- ^ The attribute sanitizer.
  -> Tag Text -> Maybe (Tag Text)
sanitizeWith ft _ t@(TagClose name)
  | ft name   = Just t
  | otherwise = Nothing
sanitizeWith
  :: (Text -> Bool)                             -- ^ The tag name sanitizer.
  -> (Attribute Text -> Maybe (Attribute Text)) -- ^ The attribute sanitizer.
  -> Tag Text -> Maybe (Tag Text)
sanitizeWith ft _ t@(TagClose name)
  | ft name   = Just t
  | otherwise = Nothing
sanitizeWith ft _ t@(TagClose name)
  | ft name   = Just t
  | otherwise = Nothing