summaryrefslogtreecommitdiff
path: root/src/Hakyll
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-06-08 15:53:36 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-06-08 15:53:36 +0200
commitd08a33a28791a2c0cbf39abb59b7770abe20ebb0 (patch)
tree69018b3462ddef1cff3f6c4a43a24bde09792ab0 /src/Hakyll
parenta6329a577bf38dff1fc9ff515e0a80023a38ee3a (diff)
parent699a4e111309278495eda50cabe678354864a449 (diff)
downloadhakyll-d08a33a28791a2c0cbf39abb59b7770abe20ebb0.tar.gz
Merge branch 'master' into type-safe-identifiers
Conflicts: hakyll.cabal
Diffstat (limited to 'src/Hakyll')
-rw-r--r--src/Hakyll/Web/Util/Html.hs30
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