hakyll-1.2: A simple static site generator library.Source codeContentsIndex
Module containing various functions to manipulate contexts.
type Context = Map String String
type ContextManipulation = Context -> Context
renderValue :: String -> String -> (String -> String) -> ContextManipulation
changeValue :: String -> (String -> String) -> ContextManipulation
renderDate :: String -> String -> String -> ContextManipulation
changeExtension :: String -> ContextManipulation
type Context = Map String StringSource
Type for a context.
type ContextManipulation = Context -> ContextSource
Type for context manipulating functions.
:: StringKey of which the value should be copied.
-> StringKey the value should be copied to.
-> String -> StringFunction to apply on the value.
-> ContextManipulation
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.
:: StringKey of which the value should be changed.
-> String -> StringFunction to apply on the value.
-> ContextManipulation

Change a value in a Context.

 import Data.Char (toUpper)
 changeValue "title" (map toUpper)

Will put the title in UPPERCASE.

:: StringKey in which the rendered date should be placed.
-> StringFormat to use on the date.
-> StringDefault value when the date cannot be parsed.
-> ContextManipulation

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.

 renderDate "date" "%B %e, %Y" "Date unknown"

Will render something like January 32, 2010.

:: StringExtension to change to.
-> ContextManipulation

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")
                 (createPagePath "test.markdown")

Will render to test.php instead of test.html.

Produced by Haddock version 2.6.0