janl/mustache.js

Section with custom attribute

ngocducdim opened this issue · 0 comments

Hi, can we add some custom attribute like WordPress shortcode in section?, for example from this:

{
  "fontWeight": function () {
    return function (text, render) {
      return '<p style="font-weight: 400">' + render(text) + '</p>';
    }
  }
}
{{#fontWeight}}
  This text is 700
{{/fontWeight}}

to be like this:

{
  "fontWeight": function () {
    return function (text, render, props) {
      return `<p style="font-weight: ${props.size}">` + render(text) + '</p>';
    }
  }
}
{{#fontWeight[size=700]}}
  This text is 700
{{/fontWeight}}

is it possible?