on master help sign in
Module cleanup.
commit42bacee41a68e9e1eaddcec0702ead71a0a1b3e6 authorJasper Van der Jeugt <jaspervdj@gmail.com> dateSun 24 Jan 2010, 16:40 (17 years ago) parentaef33d1
6 files changed+32−29
hakyll.cabal+9−9 src/Text/Hakyll/CompressCSS.hs → src/Text/Hakyll/Internal/CompressCSS.hs+1−1 src/Text/Hakyll/Render/Internal.hs → src/Text/Hakyll/Internal/Render.hs+2−10 src/Text/Hakyll/Template.hs → src/Text/Hakyll/Internal/Template.hs+16−4 src/Text/Hakyll/Render.hs+3−3 src/Text/Hakyll/Tags.hs+1−2
hakyll.cabal+9−9
@@ -35,19 +35,19 @@ library
3535 old-locale >= 1,
3636 time >= 1,
3737 binary >= 0.5
38− exposed-modules: Text.Hakyll
38+ exposed-modules: Network.Hakyll.SimpleServer
39+ Text.Hakyll
40+ Text.Hakyll.Context
41+ Text.Hakyll.File
3942 Text.Hakyll.Hakyll
43+ Text.Hakyll.Regex
4044 Text.Hakyll.Render
4145 Text.Hakyll.Renderable
4246 Text.Hakyll.Renderables
43− Text.Hakyll.CompressCSS
44− Text.Hakyll.File
4547 Text.Hakyll.Page
4648 Text.Hakyll.Util
4749 Text.Hakyll.Tags
48− Text.Hakyll.Context
49− Text.Hakyll.Regex
50− Text.Hakyll.Template
51− Network.Hakyll.SimpleServer
52− other-modules: Text.Hakyll.Render.Internal
53− Text.Hakyll.Internal.Cache
50+ other-modules: Text.Hakyll.Internal.Cache
51+ Text.Hakyll.Internal.CompressCSS
52+ Text.Hakyll.Internal.Render
53+ Text.Hakyll.Internal.Template
src/Text/Hakyll/CompressCSS.hs → src/Text/Hakyll/Internal/CompressCSS.hsrenamed+1−1
@@ -1,6 +1,6 @@
11-- | Module used for CSS compression. The compression is currently in a simple
22-- state, but would typically reduce the number of bytes by about 25%.
3−module Text.Hakyll.CompressCSS
3+module Text.Hakyll.Internal.CompressCSS
44 ( compressCSS
55 ) where
66
src/Text/Hakyll/Render/Internal.hs → src/Text/Hakyll/Internal/Render.hsrenamed+2−10
@@ -1,5 +1,5 @@
11-- | Internal module do some low-level rendering.
2−module Text.Hakyll.Render.Internal
2+module Text.Hakyll.Internal.Render
33 ( substitute
44 , regularSubstitute
55 , finalSubstitute
@@ -14,20 +14,12 @@ import Control.Monad.Reader (liftIO)
1414import Data.List (foldl')
1515import Data.Maybe (fromMaybe)
1616
17−import Text.Hakyll.Template (Template, substitute, fromString)
1817import Text.Hakyll.Context (Context, ContextManipulation)
1918import Text.Hakyll.Renderable
2019import Text.Hakyll.Page
2120import Text.Hakyll.File
2221import Text.Hakyll.Hakyll
23−
24−-- | "substitute" for use during a chain.
25−regularSubstitute :: Template -> Context -> String
26−regularSubstitute = substitute "$$"
27−
28−-- | "substitute" for the end of a chain (just before writing).
29−finalSubstitute :: Template -> Context -> String
30−finalSubstitute = substitute "$"
22+import Text.Hakyll.Internal.Template
3123
3224-- | A pure render function.
3325pureRenderWith :: ContextManipulation -- ^ Manipulation to apply on the context.
src/Text/Hakyll/Template.hs → src/Text/Hakyll/Internal/Template.hsrenamed+16−4
@@ -1,8 +1,10 @@
1−module Text.Hakyll.Template
1+module Text.Hakyll.Internal.Template
22 ( Template
33 , fromString
44 , readTemplate
55 , substitute
6+ , regularSubstitute
7+ , finalSubstitute
68 ) where
79
810import qualified Data.Map as M
@@ -46,9 +48,9 @@ readTemplate path = do
4648 where
4749 fileName = "templates" </> path
4850
49−-- | Substitutes @$identifiers@ in the given string by values from the given
50−-- "Context". When a key is not found, it is left as it is. You can here
51−-- specify the characters used to replace escaped dollars (@$$@).
51+-- | Substitutes @$identifiers@ in the given "Template" by values from the given
52+-- "Context". When a key is not found, it is left as it is. You can specify
53+-- the characters used to replace escaped dollars (@$$@) here.
5254substitute :: String -> Template -> Context -> String
5355substitute escaper (Chunk chunk template) context =
5456 chunk ++ substitute escaper template context
@@ -59,6 +61,16 @@ substitute escaper (Identifier key template) context =
5961substitute escaper (EscapeCharacter template) context =
6062 escaper ++ substitute escaper template context
6163substitute _ End _ = []
64+
65+-- | "substitute" for use during a chain. This will leave escaped characters as
66+-- they are.
67+regularSubstitute :: Template -> Context -> String
68+regularSubstitute = substitute "$$"
69+
70+-- | "substitute" for the end of a chain (just before writing). This renders
71+-- escaped characters.
72+finalSubstitute :: Template -> Context -> String
73+finalSubstitute = substitute "$"
6274
6375instance Binary Template where
6476 put (Chunk string template) = put (0 :: Word8) >> put string >> put template
src/Text/Hakyll/Render.hs+3−3
@@ -16,14 +16,14 @@ import Control.Monad (unless)
1616import Control.Monad.Reader (liftIO)
1717import System.Directory (copyFile)
1818
19−import Text.Hakyll.Template (readTemplate)
2019import Text.Hakyll.Hakyll (Hakyll)
2120import Text.Hakyll.Context (ContextManipulation)
2221import Text.Hakyll.Page
2322import Text.Hakyll.Renderable
2423import Text.Hakyll.File
25−import Text.Hakyll.CompressCSS
26−import Text.Hakyll.Render.Internal
24+import Text.Hakyll.Internal.Template (readTemplate)
25+import Text.Hakyll.Internal.CompressCSS
26+import Text.Hakyll.Internal.Render
2727
2828-- | Execute an IO action only when the cache is invalid.
2929depends :: FilePath -- ^ File to be rendered or created.
src/Text/Hakyll/Tags.hs+1−2
@@ -29,12 +29,11 @@ import System.FilePath ((</>))
2929
3030import Text.Hakyll.Hakyll (Hakyll)
3131import Text.Hakyll.Context (ContextManipulation, changeValue)
32−import Text.Hakyll.Render.Internal (finalSubstitute)
3332import Text.Hakyll.Regex
34−import Text.Hakyll.Template
3533import Text.Hakyll.Util
3634import Text.Hakyll.Page
3735import Text.Hakyll.Internal.Cache
36+import Text.Hakyll.Internal.Template
3837
3938-- | Read a tag map. This creates a map from tags to page paths.
4039--