#1 2021-05-31 06:04:38

missionhq
Member
From: Australia
Registered: 2019-06-11
Posts: 33

Mustache Helper that doesn't Escape the result

Hi
I'm trying to add a Mustache Helper that inserts some JavaScript into my HTML page
The JS content contains some double-quotes but the resulting output has these escaped - I want it to just be the straight copy of what I'm sending...
Simple example....
if my HTML Template contains...

 {{JSContent "anytext"}}

and my helper is like this...

procedure TMyMVCApplication.JSContent(const Value: variant; out result: variant);
begin
    result:= 'this.getText = function(MyAction) {return "Redo";};';
end;

the resulting HTML after  the Mustache rendering is...

this.getText = function(MyAction) {return "Redo";};

Is there any way I can stop the helper (or is it the renderer?)  ESCaping the quotes?

Offline

#2 2021-05-31 06:29:53

missionhq
Member
From: Australia
Registered: 2019-06-11
Posts: 33

Re: Mustache Helper that doesn't Escape the result

Ahh worked it out...
{{{ or {{& can be used to unescape the output

{{& JSContent "anytext"}}

Offline

Board footer

Powered by FluxBB