Link

Preparing Template

Hot-Stone using handlebars as its template engine for

Simple Expressions

Data:

{
  "firstname": "Yehuda",
  "lastname": "Katz"
}

Template:

<p>{{firstname}} {{lastname}}</p>

Nested Input Objects

Data:

{
  "person": {
    "firstname": "Yehuda",
    "lastname": "Katz"
  }
}

Template:

<p>{{person.firstname}} {{person.lastname}}</p>

HTML Escaping

It’s handle HTML Escaping by default. If you don’t want Handlebars to escape a value, use the “triple-stash”, {{{:

Data:

{ "specialChars": "& < > \" ' ` =" }

Template:

raw: {{{specialChars}}}
html-escaped: {{specialChars}}

Iterate List

Data:

{
  "people": [
    "Yehuda Katz",
    "Alan Johnson",
    "Charles Jolley"
  ]
}

Template:

<ul class="people_list">
  {{#each people}}
    <li>{{this}}</li>
  {{/each}}
</ul>

Condition

Template:

{{#if isActive}}
  <img src="star.gif" alt="Active">
{{else}}
  <img src="cry.gif" alt="Inactive">
{{/if}}