summaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Hakyll/Internal/CompressCSS.hs (renamed from src/Text/Hakyll/CompressCSS.hs)2
-rw-r--r--src/Text/Hakyll/Internal/Render.hs (renamed from src/Text/Hakyll/Render/Internal.hs)12
-rw-r--r--src/Text/Hakyll/Internal/Template.hs (renamed from src/Text/Hakyll/Template.hs)20
-rw-r--r--src/Text/Hakyll/Render.hs6
-rw-r--r--src/Text/Hakyll/Tags.hs3
5 files changed, 23 insertions, 20 deletions
diff --git a/src/Text/Hakyll/CompressCSS.hs b/src/Text/Hakyll/Internal/CompressCSS.hs
index 0836f69..7d52bef 100644
--- a/src/Text/Hakyll/CompressCSS.hs
+++ b/src/Text/Hakyll/Internal/CompressCSS.hs
@@ -1,6 +1,6 @@
-- | Module used for CSS compression. The compression is currently in a simple
-- state, but would typically reduce the number of bytes by about 25%.
-module Text.Hakyll.CompressCSS
+module Text.Hakyll.Internal.CompressCSS
( compressCSS
) where
diff --git a/src/Text/Hakyll/Render/Internal.hs b/src/Text/Hakyll/Internal/Render.hs
index 3ebc67f..a3d2d9b 100644
--- a/src/Text/Hakyll/Render/Internal.hs
+++ b/src/Text/Hakyll/Internal/Render.hs
@@ -1,5 +1,5 @@
-- | Internal module do some low-level rendering.
-module Text.Hakyll.Render.Internal
+module Text.Hakyll.Internal.Render
( substitute
, regularSubstitute
, finalSubstitute
@@ -14,20 +14,12 @@ import Control.Monad.Reader (liftIO)
import Data.List (foldl')
import Data.Maybe (fromMaybe)
-import Text.Hakyll.Template (Template, substitute, fromString)
import Text.Hakyll.Context (Context, ContextManipulation)
import Text.Hakyll.Renderable
import Text.Hakyll.Page
import Text.Hakyll.File
import Text.Hakyll.Hakyll
-
--- | "substitute" for use during a chain.
-regularSubstitute :: Template -> Context -> String
-regularSubstitute = substitute "$$"
-
--- | "substitute" for the end of a chain (just before writing).
-finalSubstitute :: Template -> Context -> String
-finalSubstitute = substitute "$"
+import Text.Hakyll.Internal.Template
-- | A pure render function.
pureRenderWith :: ContextManipulation -- ^ Manipulation to apply on the context.
diff --git a/src/Text/Hakyll/Template.hs b/src/Text/Hakyll/Internal/Template.hs
index 9ba30fb..41d279c 100644
--- a/src/Text/Hakyll/Template.hs
+++ b/src/Text/Hakyll/Internal/Template.hs
@@ -1,8 +1,10 @@
-module Text.Hakyll.Template
+module Text.Hakyll.Internal.Template
( Template
, fromString
, readTemplate
, substitute
+ , regularSubstitute
+ , finalSubstitute
) where
import qualified Data.Map as M
@@ -46,9 +48,9 @@ readTemplate path = do
where
fileName = "templates" </> path
--- | Substitutes @$identifiers@ in the given string by values from the given
--- "Context". When a key is not found, it is left as it is. You can here
--- specify the characters used to replace escaped dollars (@$$@).
+-- | Substitutes @$identifiers@ in the given "Template" by values from the given
+-- "Context". When a key is not found, it is left as it is. You can specify
+-- the characters used to replace escaped dollars (@$$@) here.
substitute :: String -> Template -> Context -> String
substitute escaper (Chunk chunk template) context =
chunk ++ substitute escaper template context
@@ -59,6 +61,16 @@ substitute escaper (Identifier key template) context =
substitute escaper (EscapeCharacter template) context =
escaper ++ substitute escaper template context
substitute _ End _ = []
+
+-- | "substitute" for use during a chain. This will leave escaped characters as
+-- they are.
+regularSubstitute :: Template -> Context -> String
+regularSubstitute = substitute "$$"
+
+-- | "substitute" for the end of a chain (just before writing). This renders
+-- escaped characters.
+finalSubstitute :: Template -> Context -> String
+finalSubstitute = substitute "$"
instance Binary Template where
put (Chunk string template) = put (0 :: Word8) >> put string >> put template
diff --git a/src/Text/Hakyll/Render.hs b/src/Text/Hakyll/Render.hs
index 9484859..3329994 100644
--- a/src/Text/Hakyll/Render.hs
+++ b/src/Text/Hakyll/Render.hs
@@ -16,14 +16,14 @@ import Control.Monad (unless)
import Control.Monad.Reader (liftIO)
import System.Directory (copyFile)
-import Text.Hakyll.Template (readTemplate)
import Text.Hakyll.Hakyll (Hakyll)
import Text.Hakyll.Context (ContextManipulation)
import Text.Hakyll.Page
import Text.Hakyll.Renderable
import Text.Hakyll.File
-import Text.Hakyll.CompressCSS
-import Text.Hakyll.Render.Internal
+import Text.Hakyll.Internal.Template (readTemplate)
+import Text.Hakyll.Internal.CompressCSS
+import Text.Hakyll.Internal.Render
-- | Execute an IO action only when the cache is invalid.
depends :: FilePath -- ^ File to be rendered or created.
diff --git a/src/Text/Hakyll/Tags.hs b/src/Text/Hakyll/Tags.hs
index 77f52fe..d36a866 100644
--- a/src/Text/Hakyll/Tags.hs
+++ b/src/Text/Hakyll/Tags.hs
@@ -29,12 +29,11 @@ import System.FilePath ((</>))
import Text.Hakyll.Hakyll (Hakyll)
import Text.Hakyll.Context (ContextManipulation, changeValue)
-import Text.Hakyll.Render.Internal (finalSubstitute)
import Text.Hakyll.Regex
-import Text.Hakyll.Template
import Text.Hakyll.Util
import Text.Hakyll.Page
import Text.Hakyll.Internal.Cache
+import Text.Hakyll.Internal.Template
-- | Read a tag map. This creates a map from tags to page paths.
--