You are not logged in.
Pages: 1
Hi all,
some days ago I talked with Arnaud about the possiblity to add into SynMustache some, so called, "filters" just like the angualrjs ones or the handlebarsjs ones. HEre the proposal.
"I'm wondering if in SynMustache does exists the possibility to call a formatting function inside the template.
This is because if I need presentation logic implemented in Delphi (because mustache is logicless) I have to prepare data before to send it to the renders.
Something like:
in Delphi
Mustache.AddTemplateFunction('dollars', function (Values: TArray<TValue>): String
begin
Result := Format(Values[1].AsString, [Values[0].AsDouble]);
end);
and in the template
{{mydata|dollars:'$ ###0.00'}}
N.B. In the template I've used the angularjs filters syntax, but just to be clear (https://docs.angularjs.org/api/ng/filter/filter)
I know there isn't such concept in Mustache, but this is a nice addition to the standard IMHO, and doesn't break it."
Arnaud suggest that handlebars syntax could be also a viable solution.
Both angularjs and handlebars syntax are nice, coherent and powerful. As my personal favourite, I'd like to have angularjs syntax, but probably makes sense to implement handlebars syntax. So my vote goes for Handlebars syntax.
Any other POV?
Pages: 1