Reputation: 900
I'm trying to understand what does {X4 means. theres an example on Handlbars site: http://handlebarsjs.com/block_helpers.html the last example is:
Raw Blocks
Raw blocks are available for templates needing to handle unprocessed mustache blocks. {{{{raw-helper}}}} {{bar}} {{{{/raw-helper}}}} will execute the helper raw-helper without interpretting the content. Handlebars.registerHelper('raw-helper', function(options) { return options.fn(); }); will render {{bar}}
Upvotes: 1
Views: 513
Reputation: 8325
data inside {{{}}}
blocks are not processed and displayed raw (as is), most importantly not html-escaped (http://handlebarsjs.com/expressions.html).
example (just for illustration):
{{{<span></span>}}}
outputs <span></span>
while
{{<span></span>}}
outputs <span></span>
Raw blocks with 4 {{{{}}}}
(http://handlebarsjs.com/block_helpers.html) provide a similar functionality as above but for block declarations. Meaning everything inside the block will be output as is.
This is just a variation on the notation, i presume to make compilation easier since 3 {{{}}}
tags have already a fixed meaning for raw tags
Another functionality this accomplishes is meta-templating, meaning a template can output another template code (in same language, i.e handlebars), which is then used as a normal template. For example from server rendering to client rendering (i think this github issue and this are related to the introduction of raw blocks declaration in handlebars)
Upvotes: 1