From 547f98dff029d011e6498c901190de11a0bc9c61 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Fri, 8 Jan 2010 09:42:33 +0100 Subject: Added link function. --- src/Text/Hakyll/File.hs | 1 + src/Text/Hakyll/Util.hs | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'src/Text') diff --git a/src/Text/Hakyll/File.hs b/src/Text/Hakyll/File.hs index c535b11..0c803e1 100644 --- a/src/Text/Hakyll/File.hs +++ b/src/Text/Hakyll/File.hs @@ -50,6 +50,7 @@ getRecursiveContents topdir = do -- | A filter that takes all file names with a given extension. Prefix the -- extension with a dot: +-- -- > havingExtension ".markdown" ["index.markdown", "style.css"] == ["index.markdown"] havingExtension :: String -> [FilePath] -> [FilePath] havingExtension extension = filter ((==) extension . takeExtension) 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" == "foo" +link :: String -> String -> String +link text destination = "" + ++ text ++ "" -- cgit v1.2.3