The render command


render <template> with (<arg list>)



The render command implements a simple template language. This language has two rules:

The result of rendering the template will be stored in the result (or it) variable.

For example, if we want to render a list of colors:

  _="on click
    render #color-template with (colors: getColors())
    then put it into #colors"
  Get the colors

Our template might look like this:

<template id="color-template">
    @repeat in colors
      @set bg to it
      @set fg to getContrastingColor(it)
      <li style="background: ${bg}; color: ${unescaped fg}">${bg}</li>