diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-02-15 22:20:39 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-02-15 22:20:39 +0100 |
commit | bc4fef81b7143d3b2035f3bd28fe89bea8dbc30d (patch) | |
tree | 605178927e5a07c1afbe0794a3997cdfe0e921e2 /src/Hakyll/Web/RelativizeUrls.hs | |
parent | d00026366c78ef8578f7a9503ced4915b1d4ec28 (diff) | |
download | hakyll-bc4fef81b7143d3b2035f3bd28fe89bea8dbc30d.tar.gz |
defaultRelativizeUrls → relativizeUrlsCompiler
Diffstat (limited to 'src/Hakyll/Web/RelativizeUrls.hs')
-rw-r--r-- | src/Hakyll/Web/RelativizeUrls.hs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/Hakyll/Web/RelativizeUrls.hs b/src/Hakyll/Web/RelativizeUrls.hs index 40a5847..1df4fea 100644 --- a/src/Hakyll/Web/RelativizeUrls.hs +++ b/src/Hakyll/Web/RelativizeUrls.hs @@ -15,14 +15,31 @@ -- > <img src="../images/lolcat.png" alt="Funny zomgroflcopter" /> -- module Hakyll.Web.RelativizeUrls - ( relativizeUrls + ( relativizeUrlsCompiler + , relativizeUrls ) where +import Prelude hiding (id) +import Control.Category (id) +import Control.Arrow ((&&&), (>>^)) import Data.List (isPrefixOf) import qualified Data.Set as S import Text.HTML.TagSoup +import Hakyll.Core.Compiler +import Hakyll.Web.Page +import Hakyll.Web.Util.String + +-- | Compiler form of 'compressCss' which automatically picks the right root +-- path +-- +relativizeUrlsCompiler :: Compiler (Page String) (Page String) +relativizeUrlsCompiler = getRoute &&& id >>^ uncurry relativize + where + relativize Nothing = id + relativize (Just r) = fmap (relativizeUrls $ toSiteRoot r) + -- | Relativize URL's in HTML -- relativizeUrls :: String -- ^ Path to the site root |