What does this expression mean?

3

By studying Node-Red a bit I came across the following expression, {{#header.url} .

Many expressions of the type are present in the code, for example: {{/header.url}} , {{#header.image}} , etc. Here is a snippet of code:

<span class="logo">{{#header.url}}<a href="{{.}}">{{/header.url}}{{#header.image}}<img src="{{.}}" title="{{version}}">{{/header.image}} <span>{{ header.title }}</span>{{#header.url}}</a>{{/header.url}}</span>
<ul class="header-toolbar hide">

Can anyone tell me what this expression is doing?

    
asked by anonymous 13.04.2017 / 21:25

1 answer

3

This is very typical of Mustache , a template language that compiles HTML.

The JavaScript version ( Mustache.js ) has an example in the documentation:

View:

{
  "person": false
}

Template:

Shown.
{{#person}}
Never shown!
{{/person}}

Output:

Shown.

That is, an object with properties is configured, then in the template whatever is between {{#person}} and {{/person}} will be included if pessoa is true .

    
13.04.2017 / 21:33