Safe Haskell | None |
---|
- newtype Context a = Context {}
- mapContext :: (String -> String) -> Context a -> Context a
- field :: String -> (Item a -> Compiler String) -> Context a
- constField :: String -> String -> Context a
- functionField :: String -> ([String] -> Item a -> Compiler String) -> Context a
- defaultContext :: Context String
- bodyField :: String -> Context String
- metadataField :: Context String
- urlField :: String -> Context a
- pathField :: String -> Context a
- titleField :: String -> Context a
- dateField :: String -> String -> Context a
- dateFieldWith :: TimeLocale -> String -> String -> Context a
- getItemUTC :: TimeLocale -> Identifier -> Compiler UTCTime
- modificationTimeField :: String -> String -> Context a
- modificationTimeFieldWith :: TimeLocale -> String -> String -> Context a
- missingField :: Context a
Documentation
constField :: String -> String -> Context aSource
metadataField :: Context StringSource
Map any field to its metadata value, if present
titleField :: String -> Context aSource
This title field takes the basename of the underlying file by default
:: String | Key in which the rendered date should be placed |
-> String | Format to use on the date |
-> Context a | Resulting context |
When the metadata has a field called published
in one of the
following formats then this function can render the date.
-
Sun, 01 Feb 2000 13:00:00 UT
(RSS date format) -
2000-02-01T13:00:00Z
(Atom date format) -
February 1, 2000 1:00 PM
(PM is usually uppercase) -
February 1, 2000
(assumes 12:00 AM for the time)
Alternatively, when the metadata has a field called path
in a
folder/yyyy-mm-dd-title.extension
format (the convention for pages)
and no published
metadata field set, this function can render
the date.
renderDateField "date" "%B %e, %Y" "Date unknown"
Will render something like January 32, 2010
.
:: TimeLocale | Output time locale |
-> String | Destination key |
-> String | Format to use on the date |
-> Context a | Resulting context |
:: TimeLocale | Output time locale |
-> Identifier | Input page |
-> Compiler UTCTime | Parsed UTCTime |
Parser to try to extract and parse the time from the published
field or from the filename. See renderDateField
for more information.
Exported for user convenience.
modificationTimeFieldWithSource
:: TimeLocale | Time output locale |
-> String | Key |
-> String | Format |
-> Context a | Resulting context |