Text interpolation

Text interpolation is one of the most essential features of templates. It allows you to render text from contextual data.

Every text of the format {{ foo }} will be evaluated as text interpolation.

For example, let's say that we have a Creator making a call to buildPage with the following context data:

  foo: 'foo',
  bar: 'bar',
  joinWords: (...words: string[]) => words.join('-')

And that our template looks something like that:

  <p>{{ foo }}</p>
  <p>{{ bar }}</p>
  <p>{{ 1 + 2 }}</p>
  <p>{{ joinWords(foo, bar) }}</p>
  <p>{{ `${foo} ${Math.random()}` }}</p>

Once built, our page will look like that:

  <p>foo 0.351321</p>

Something about this page is wrong? Edit it on GitHub.