jehugaleahsa / mustache-sharp

An extension of the mustache text template engine for .NET.
The Unlicense
306 stars 80 forks source link

Redundancy and differencies with mustach spec making it not compliant. #88

Open Baccanno opened 5 years ago

Baccanno commented 5 years ago

I've been using mustach for more than 5 years, and I never understood the role of additionnal handlebar.js spec and its apparent redudancy with the equivalent functionnality in mustach spec.

I really like the simplicity yet powerfulness of the functionnal approach of the original spec, and I usually stick with it, can someone explain me what specific cases asks for this addition ? Moreover I'm very fearfull of going out of spec as it's not easy for people to catch out the subtle differences when switching from one to an other implementation.

So in the end I'm really questionning the fact this project is called "mustache-sharp" and not "myown-mustache-sharp"

I'm especially talking of with, if and each tag.

in mustach {{#var}}{{.}}{{/var}} is equivalent to proposed {{#if var}}{{.}}{{/endif}} "else" is also there {{^var}}{{.}}{{/var}}

for "loops" like in this structure { var : [ { element : 1 },{ element : 2 } ] } in mustach {{#var}}{{element}}{{/var}} is equivalent to proposed {{#each var}}{{element}}{{/each}} as it will iterate on its own.

And finally with tag, as Mustach spec figures out the most nested context before going upward. Data : { var : { level1 : { level2 }}} {{#var}}{{level1.level2}}{{/var}} is equivalent to {{#with var}}{{level1.level2}}{{/with}}

One of the out of spec feature for instance being the {{#newLine}} and treatment of returns.

It would be better to discuss and showcase how to do thing with the original spec that adapt it one-sidedly. It is really an issue from my point of view as I can't find any strict mustach implementation that is maintained in c# and this one is referenced on the official website.