|
Text.Hakyll.ContextManipulations |
|
|
Description |
This module exports a number of functions that produce HakyllActions to
manipulate Contexts.
|
|
Synopsis |
|
|
|
Documentation |
|
|
:: 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.
| -> HakyllAction Context Context | | Do something with a value in a Context, but keep the old value as well.
If the key given is not present in the Context, nothing will happen.
|
|
|
|
:: String | Key to change.
| -> (String -> String) | Function to apply on the value.
| -> HakyllAction Context Context | | Change a value in a Context.
import Data.Char (toUpper)
changeValue "title" (map toUpper)
Will put the title in UPPERCASE.
|
|
|
|
|
|
|
:: String | Key in which the rendered date should be placed.
| -> String | Format to use on the date.
| -> String | Default key, in case the date cannot be parsed.
| -> HakyllAction Context Context | | 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"
Will render something like January 32, 2010.
|
|
|
|
:: String | Extension to change to.
| -> HakyllAction Context Context | | 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.
changeExtension "php"
Will render test.markdown to test.php instead of test.html.
|
|
|
|
Change the body of a file using a certain manipulation.
import Data.Char (toUpper)
renderBody (map toUpper)
Will put the entire body of the page in UPPERCASE.
|
|
Produced by Haddock version 2.7.2 |