summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll/ContextManipulations.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-03-11 12:10:55 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-03-11 12:10:55 +0100
commita2c15932b713e81dcd1344f9227db2c3a65103bf (patch)
tree17169c09c2957f6d88938d148c9432d71def89fb /src/Text/Hakyll/ContextManipulations.hs
parentd25b0b683410211530c977625685349b11b8ff72 (diff)
downloadhakyll-a2c15932b713e81dcd1344f9227db2c3a65103bf.tar.gz
Gave some functions better (more appropriate) names.
Diffstat (limited to 'src/Text/Hakyll/ContextManipulations.hs')
-rw-r--r--src/Text/Hakyll/ContextManipulations.hs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/Text/Hakyll/ContextManipulations.hs b/src/Text/Hakyll/ContextManipulations.hs
index c526816..9f95232 100644
--- a/src/Text/Hakyll/ContextManipulations.hs
+++ b/src/Text/Hakyll/ContextManipulations.hs
@@ -21,8 +21,7 @@ import Text.Hakyll.HakyllAction (HakyllAction)
import Text.Hakyll.Context (Context)
-- | Do something with a value in a @Context@, but keep the old value as well.
--- This is probably the most common function to construct a
--- @ContextManipulation@.
+-- If the key given is not present in the @Context@, nothing will happen.
renderValue :: String -- ^ Key of which the value should be copied.
-> String -- ^ Key the value should be copied to.
-> (String -> String) -- ^ Function to apply on the value.
@@ -49,8 +48,9 @@ copyValue :: String -- ^ Source key.
-> HakyllAction Context Context
copyValue source destination = renderValue source destination id
--- | When the context has a key called @path@ in a @yyyy-mm-dd-title.extension@
--- format (default for pages), this function can render the date.
+-- | When the context has a key called @path@ in a
+-- @folder/yyyy-mm-dd-title.extension@ format (the convention for pages),
+-- this function can render the date.
--
-- > renderDate "date" "%B %e, %Y" "Date unknown"
--
@@ -72,11 +72,9 @@ renderDate key format defaultValue = renderValue "path" key renderDate'
-- | Change the extension of a file. This is only needed when you want to
-- render, for example, mardown to @.php@ files instead of @.html@ files.
--
--- > renderChainWith (changeExtension "php")
--- > ["templates/default.html"]
--- > (createPagePath "test.markdown")
+-- > changeExtension "php"
--
--- Will render to @test.php@ instead of @test.html@.
+-- Will render @test.markdown@ to @test.php@ instead of @test.html@.
changeExtension :: String -- ^ Extension to change to.
-> HakyllAction Context Context
changeExtension extension = changeValue "url" changeExtension'