Pope.cr
A Crystal version of Pope
A fast, minimal and micro template engine for strings only, it plays well where you want to embed micro templates inside your module.
Installation
- Add the dependency to your
shard.yml
:
dependencies:
pope.cr:
github: krthr/pope.cr
- Run
shards install
Usage
See the API page > https://krthr.github.io/pope.cr/
require "pope.cr"
data = {
user: {
id: 123,
username: "krthr",
admin: true,
config: {
email: "test@test.com",
},
},
}
Pope.pope(
"The user {{user.username}} with id {{user.id}} is cool",
data
) # "The user krthr with id 123 is cool"
Pope.prop(data, "user.id") # 123
Pope.prop(data, "user.config.email") # test@test.com
Pope.prop(data, "nananana") # nil
Contributing
- Fork it (<https://github.com/krthr/pope.cr/fork>)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- krthr - creator and maintainer