crustache

0.2.1 released

crustache

crustache is the implementation of mustache logic-less templates.

This library implemated mustache's spec v1.1.2+λ.

travis-ci.org docrystal.org

                        __             __
  ____________  _______/ /_____ ______/ /_  ___
 / ___/ ___/ / / / ___/ __/ __ `/ ___/ __ \/ _ \
/ /__/ /  / /_/ (__  ) /_/ /_/ / /__/ / / /  __/
\___/_/   \__,_/____/\__/\__,_/\___/_/ /_/\___/

Installation

Add it to Projectfile

deps do
  github "MakeNowJust/crustache"
end

Usage

require "crustache"

# Define a type for model
alias Model = String | Hash(String, Model)

# Parse a mustache template
template = Crustache.parse "Hello {{Name}} World!"

# Make a model
model = {} of String => Model
model["Name"] = "Crustache"

# Render!
puts Crustache.render template, model as Model
#=> Hello Crustache World!

Development

This library's specs are put in spec directory. They can run by crystal spec ./spec/spec.cr command.

Contributing

  1. Fork it ( https://github.com/MakeNowJust/crustache/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

crustache:
  github: MakeNowJust/crustache
  version: ~> 0.2.1
Crystal none

Dependencies 0

Development Dependencies 0

Last synced .
search fire star recently