summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Hakyll/Web.hs13
-rw-r--r--src/Hakyll/Web/CompressCss.hs3
-rw-r--r--src/Hakyll/Web/RelativizeUrls.hs19
3 files changed, 20 insertions, 15 deletions
diff --git a/src/Hakyll/Web.hs b/src/Hakyll/Web.hs
index bd9ce31..72b22dd 100644
--- a/src/Hakyll/Web.hs
+++ b/src/Hakyll/Web.hs
@@ -3,14 +3,11 @@
module Hakyll.Web
( defaultTemplateRead
, defaultTemplateReadWith
- , defaultRelativizeUrls
, defaultCopyFile
, defaultApplyTemplate
) where
-import Prelude hiding (id)
-import Control.Category (id)
-import Control.Arrow ((>>^), (&&&))
+import Control.Arrow ((>>^))
import Text.Hamlet (HamletSettings)
@@ -20,14 +17,6 @@ import Hakyll.Core.Identifier
import Hakyll.Core.ResourceProvider
import Hakyll.Web.Page
import Hakyll.Web.Template
-import Hakyll.Web.RelativizeUrls
-import Hakyll.Web.Util.String
-
-defaultRelativizeUrls :: Compiler (Page String) (Page String)
-defaultRelativizeUrls = getRoute &&& id >>^ uncurry relativize
- where
- relativize Nothing = id
- relativize (Just r) = fmap (relativizeUrls $ toSiteRoot r)
defaultTemplateRead :: Compiler Resource Template
defaultTemplateRead = cached "Hakyll.Web.defaultTemplateRead" $ templateRead
diff --git a/src/Hakyll/Web/CompressCss.hs b/src/Hakyll/Web/CompressCss.hs
index 3e86e09..94ba9a9 100644
--- a/src/Hakyll/Web/CompressCss.hs
+++ b/src/Hakyll/Web/CompressCss.hs
@@ -14,8 +14,7 @@ import Hakyll.Core.Compiler
import Hakyll.Core.ResourceProvider
import Hakyll.Web.Util.String
--- | Compiler form of 'compressCss' which automatically picks the right root
--- path
+-- | Compiler form of 'compressCss'
--
compressCssCompiler :: Compiler Resource String
compressCssCompiler = getResourceString >>^ compressCss
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