diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-06-05 23:07:00 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-06-05 23:07:00 +0200 |
commit | cee7648fcf40580295ab30fa9ce676086a8c3028 (patch) | |
tree | a5fa4adf92bd9726876d513f4f34c2f067b17c95 /src/Hakyll | |
parent | 51f0bfc195aca8b911614fe3d84cb2551d722e3d (diff) | |
download | hakyll-cee7648fcf40580295ab30fa9ce676086a8c3028.tar.gz |
Add stripTags function
Diffstat (limited to 'src/Hakyll')
-rw-r--r-- | src/Hakyll/Web/Util/Html.hs | 30 |
1 files changed, 30 insertions, 0 deletions
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 "<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 |