summaryrefslogtreecommitdiff
path: root/src/Hakyll/Web/Util/Html.hs
blob: 5330cddd406fcb3969aa603cf3f5fe7a17d32088 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
-- | Miscellaneous HTML manipulation functions
--
module Hakyll.Web.Util.Html
    ( stripTags
    ) where

-- | Strip all HTML tags from a string
--
-- Example:
--
-- > stripTags "<p>foo</p>"
--
-- Result:
--
-- > "foo"
--
-- This also works for incomplete tags
--
-- Example:
--
-- > stripTags "<p>foo</p"
--
-- Result:
--
-- > "foo"
--
stripTags :: String -> String
stripTags []         = []
stripTags ('<' : xs) = stripTags $ drop 1 $ dropWhile (/= '>') xs
stripTags (x : xs)   = x : stripTags xs