The hastache-aeson package

[Tags: bsd3, library]

The Module lets you render Hastache templates from aeson values. See the GitHub page for examples.


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.1.1.0
Change logNone available
Dependenciesaeson (>=0.7.0.4), base (>=4.6 && <5), bytestring (>=0.10), containers (>=0.5), hastache (>=0.5), scientific (>=0.2), text (>=0.11), unordered-containers (>=0.2), vector (>=0.10) [details]
LicenseBSD3
CopyrightVladimir Kirillov
AuthorVladimir Kirillov <proger@hackndev.com>
MaintainerVladimir Kirillov <proger@hackndev.com>
CategoryText
Home pagehttps://github.com/proger/hastache-aeson
Bug trackerhttps://github.com/proger/hastache-aeson/issues
Source repositoryhead: git clone git://github.com/proger/hastache-aeson.git
UploadedFri Sep 11 10:34:43 UTC 2015 by VladimirKirillov
DistributionsNixOS:0.1.1.0
Downloads326 total (12 in last 30 days)
Votes
0 []
StatusDocs available [build log]
Last success reported on 2015-09-11 [all 1 reports]

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for hastache-aeson-0.1.1.0

hastache-aeson

Build Status

Example

{-# LANGUAGE OverloadedStrings #-}

import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy.Char8 as LBS

import Control.Monad
import Data.Maybe (fromJust)

import Data.Yaml
import Text.Hastache
import Text.Hastache.Aeson (jsonValueContext)

event = BS.readFile "event.yaml"
template = BS.readFile "index.mustache"

render template value = hastacheStr defaultConfig template (jsonValueContext value)

main = do
    value <- liftM (fromJust . decode) event :: IO Value
    template' <- template
    render template' value >>= LBS.putStrLn

Contributors