This gem is built to take a template and replace its keys with the specified content.
A template should always be html, and the keys should be css identifiers, and the content should be html safe.
gem 'template_chips'
or
$ gem install template_chips
template_html
...
<div>
<h1>
<div id="title"></div>
</h1>
<p>
<span id="description"></span>
</p>
</div>
chips processor
...
output = Chips::Template::Processor.new(
template_html,
mortises: {
'title': '#title',
'desc': '#description'
},
tenons: {
'title': 'Hello World!',
'desc': 'lorem ipsum'
}
).generate()
output
...
<div>
<h1>
Hello World!
</h1>
<p>
lorem ispum
</p>
</div>
TODO: Put something here
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/template_chips.
The gem is available as open source under the terms of the MIT License.