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

Versions 0.1.0.0, 0.1.1.0
Dependencies aeson (>=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]
License BSD3
Copyright Vladimir Kirillov
Author Vladimir Kirillov <proger@hackndev.com>
Maintainer Vladimir Kirillov <proger@hackndev.com>
Stability Unknown
Category Text
Home page https://github.com/proger/hastache-aeson
Bug tracker https://github.com/proger/hastache-aeson/issues
Source repository head: git clone git://github.com/proger/hastache-aeson.git
Uploaded Fri Sep 11 10:34:43 UTC 2015 by VladimirKirillov
Distributions NixOS:0.1.1.0
Downloads 356 total (9 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2015-09-11 [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for hastache-aeson

Readme for hastache-aeson-0.1.1.0

hastache-aeson

Build Status

  • Lets you pass aeson Value as MuContext to hastache
  • Since yaml is API-compatible to aeson, you can also render yaml Values.

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

  • Viktar Basharymau
  • Vladimir Kirillov