diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Hakyll.hs | 2 | ||||
-rw-r--r-- | src/Hakyll/Web/Util/Html.hs | 30 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/Hakyll.hs b/src/Hakyll.hs index 341bb53..533f19d 100644 --- a/src/Hakyll.hs +++ b/src/Hakyll.hs @@ -28,6 +28,7 @@ module Hakyll , module Hakyll.Web.RelativizeUrls , module Hakyll.Web.Tags , module Hakyll.Web.Template + , module Hakyll.Web.Util.Html , module Hakyll.Web.Util.Url ) where @@ -58,4 +59,5 @@ import Hakyll.Web.Pandoc.FileType import Hakyll.Web.RelativizeUrls import Hakyll.Web.Tags import Hakyll.Web.Template +import Hakyll.Web.Util.Html import Hakyll.Web.Util.Url 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 |