Closed camstuart closed 3 years ago
Hi,
I am interpolating JSON into a mustache template and the quoted field names of the JSON object are being HTML escaped.
Data being passed to the template:
[ { "x": 1599160499999, "text": "entry: 53.13 stop: 52.86435", "title": "ENTRY" } ]
Template:
{ type : 'flags', data : {{signals}}, onSeries : 'candlestick', shape : 'flag' },
Generated to my HTML/JavaScript on disk:
data : [ { "x": 1599160499999, "text": "entry: 53.13 stop: 52.86435", "title": "ENTRY" } ]
When I pass this data into the template, it would be great if I could "disable" escaping. EG mark this html contect as "safe" Perhaps something like:
my $html = $stache.render('highchart-candlestick', { signals => ( :content( to-json(@signal-series) ), :html-safe(True) ) });
Note: to-json being used from JSON::Fast
to-json
JSON::Fast
Hi, Cam. I'm sorry I didn't see this earlier.
If you use three curly braces, no escaping is done, for example: {{{signals}}}.
{{{signals}}}
Hi,
I am interpolating JSON into a mustache template and the quoted field names of the JSON object are being HTML escaped.
Data being passed to the template:
Template:
Generated to my HTML/JavaScript on disk:
When I pass this data into the template, it would be great if I could "disable" escaping. EG mark this html contect as "safe" Perhaps something like:
Note:
to-json
being used fromJSON::Fast