Skip to content

0.0.11 - Introducing Directives

Compare
Choose a tag to compare
@cblanquera cblanquera released this 03 Jun 17:24
· 139 commits to main since this release

Directives

A directive specifies how a compiler (or other translator) should process
its input. Temple compiler now allows custom directives and has predefined
directives built-in that can be overridden.

Conditional Directive

<if true={count === 1}>
  <p>Count is 1</p>
<elif true={count === 2} />
  <p>Count is 2</p>
<else />
  <p>Count is not 1 or 2</p>
</if>

Iterator Directive

<each key=index value=item from=list>
  <li>{index} {item}</li>
</each>

Try Catch Directive

<try>
  <p>{unknown_variable}</p>
<catch error=err />
  <p>{err.message}</p>
</try>

Full Changelog: 0.0.10...0.0.11