templayed.js icon indicating copy to clipboard operation
templayed.js copied to clipboard

Making a {{#section}} from a string iterates over each character

Open fionawhim opened this issue 7 years ago • 0 comments

I realize that this is under-specified in the Mustache spec, but it looks like templayed.js, when making a {{#section}} for a string value, iterates its contents character-by-character rather than as a single string.

Repro on http://archan937.github.io/templayed.js/

Template:

Hi, {{#name}}{{.}}<br/>{{/name}}! Try out {{library}} yourself now.

Data:

{name: "stranger", library: "templayed.js"}

Expected result:

Hi, stranger<br>! Try out templayed.js yourself now.

Actual result:

Hi, s<br>t<br>r<br>a<br>n<br>g<br>e<br>r<br>! Try out templayed.js yourself now.

The mustache demo here: https://mustache.github.io/#demo matches the expected result.

fionawhim avatar Feb 15 '18 13:02 fionawhim