diff options
Diffstat (limited to 'src/Text/Hakyll/Util.hs')
-rw-r--r-- | src/Text/Hakyll/Util.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Text/Hakyll/Util.hs b/src/Text/Hakyll/Util.hs index d498281..319bed4 100644 --- a/src/Text/Hakyll/Util.hs +++ b/src/Text/Hakyll/Util.hs @@ -2,6 +2,7 @@ module Text.Hakyll.Util ( trim , split , stripHTML + , link ) where import Data.Char (isSpace) @@ -26,3 +27,10 @@ stripHTML str = let (beforeTag, rest) = break (== '<') str split :: String -> String -> [String] split pattern = filter (not . null) . splitRegex (mkRegex pattern) + +-- | Make a HTML link. +-- +-- > link "foo" "bar.html" == "<a href='bar.html'>foo</a>" +link :: String -> String -> String +link text destination = "<a href=\"" ++ destination ++ "\">" + ++ text ++ "</a>" |