I have a mustache template where I would like to surround the variables with {}
var output = Mustache.render('<td>{{{start.lat}}, {{start.lon}}}</td>', routeObj);
I'd like this to output a <td>
with the string: {1.8978, 30.4545}
{{{ has special meaning in mustache so it doesn't work. Is there a way to escape the first { in mustache?
Two ways I can think of:
var output = Mustache.render('<td>{{=<% %>=}}{<% start.lat %>, <% start.lon %>}<%={{ }}=%></td>', routeObj);
routeObj.openbrace = '{';
routeObj.closebrace = '}';
var output = Mustache.render('<td>{{openbrace}}{{start.lat}}, {{start.lon}}{{closebrace}}</td>', routeObj);
What @alanhamlett said, also, html entities: {
is {
this all works. thanks!
Most helpful comment
Two ways I can think of:
var output = Mustache.render('<td>{{=<% %>=}}{<% start.lat %>, <% start.lon %>}<%={{ }}=%></td>', routeObj);
routeObj.openbrace = '{'; routeObj.closebrace = '}'; var output = Mustache.render('<td>{{openbrace}}{{start.lat}}, {{start.lon}}{{closebrace}}</td>', routeObj);