From cee7648fcf40580295ab30fa9ce676086a8c3028 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Sun, 5 Jun 2011 23:07:00 +0200 Subject: Add stripTags function --- src/Hakyll/Web/Util/Html.hs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/Hakyll/Web/Util/Html.hs (limited to 'src/Hakyll') diff --git a/src/Hakyll/Web/Util/Html.hs b/src/Hakyll/Web/Util/Html.hs new file mode 100644 index 0000000..5330cdd --- /dev/null +++ b/src/Hakyll/Web/Util/Html.hs @@ -0,0 +1,30 @@ +-- | Miscellaneous HTML manipulation functions +-- +module Hakyll.Web.Util.Html + ( stripTags + ) where + +-- | Strip all HTML tags from a string +-- +-- Example: +-- +-- > stripTags "

foo

" +-- +-- Result: +-- +-- > "foo" +-- +-- This also works for incomplete tags +-- +-- Example: +-- +-- > stripTags "

foo "foo" +-- +stripTags :: String -> String +stripTags [] = [] +stripTags ('<' : xs) = stripTags $ drop 1 $ dropWhile (/= '>') xs +stripTags (x : xs) = x : stripTags xs -- cgit v1.2.3