From f0af2a3b79ea7eea3f521f79fd903f9023ec85df Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Tue, 13 Nov 2012 17:31:03 +0100 Subject: WIP --- src/Hakyll/Web/Urls/Relativize.hs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/Hakyll/Web/Urls') diff --git a/src/Hakyll/Web/Urls/Relativize.hs b/src/Hakyll/Web/Urls/Relativize.hs index 0251cfe..068ae09 100644 --- a/src/Hakyll/Web/Urls/Relativize.hs +++ b/src/Hakyll/Web/Urls/Relativize.hs @@ -21,10 +21,7 @@ module Hakyll.Web.Urls.Relativize -------------------------------------------------------------------------------- -import Control.Arrow ((&&&), (>>^)) -import Control.Category (id) import Data.List (isPrefixOf) -import Prelude hiding (id) -------------------------------------------------------------------------------- @@ -36,11 +33,12 @@ import Hakyll.Web.Urls -------------------------------------------------------------------------------- -- | Compiler form of 'relativizeUrls' which automatically picks the right root -- path -relativizeUrlsCompiler :: Compiler Page Page -relativizeUrlsCompiler = getRoute &&& id >>^ uncurry relativize - where - relativize Nothing = id - relativize (Just r) = relativizeUrls $ toSiteRoot r +relativizeUrlsCompiler :: Page -> Compiler Page +relativizeUrlsCompiler page = do + route <- getRoute + return $ case route of + Nothing -> page + Just r -> relativizeUrls (toSiteRoot r) page -------------------------------------------------------------------------------- -- cgit v1.2.3