diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-11-13 17:31:03 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-11-13 17:31:03 +0100 |
commit | f0af2a3b79ea7eea3f521f79fd903f9023ec85df (patch) | |
tree | bbc460b65ab52879c616dffce1bb32fe8d8df2ac /src/Hakyll/Web/Urls | |
parent | d2e913f42434841c584b97ae9d5417ff2737c0ce (diff) | |
download | hakyll-f0af2a3b79ea7eea3f521f79fd903f9023ec85df.tar.gz |
WIP
Diffstat (limited to 'src/Hakyll/Web/Urls')
-rw-r--r-- | src/Hakyll/Web/Urls/Relativize.hs | 14 |
1 files changed, 6 insertions, 8 deletions
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 -------------------------------------------------------------------------------- |