jehugaleahsa / mustache-sharp

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

#unless helper is not supported #23

Open nikkilocke opened 10 years ago

nikkilocke commented 10 years ago

http://handlebarsjs.com/ documents the #unless helper (inverse of #if) but mustache-csharp does not appear to support it.

PaulGrimshaw commented 10 years ago

I raised this previously https://github.com/jehugaleahsa/mustache-sharp/issues/9.

As a workaround, you can use {{#if ...}}{{#else}}Content{{/if}}}

nikkilocke commented 10 years ago

I'll probably try to fix it next time I look at the code.

Nikki Locke, Trumphurst Ltd. PC & Unix consultancy & programming http://www.trumphurst.com/

nikkilocke commented 10 years ago

Now pushed a fix for this

bryant988 commented 8 years ago

@nikkilocke, I don't see the updates for {{#unless}} in this branch nor in yours. Is it intended to be merged into this branch?

nikkilocke commented 8 years ago

Hi Bryant,

That's probably because I found it too difficult, so gave up and used the workround instead!

Regards,

Nikki

Bryant Gallardo wrote:

@nikkilocke, I don't see the updates for {{#unless}} in this branch nor in yours. Is it intended to be merged into this branch?

— Reply to this email directly or view it on GitHub.

Nikki Locke, Trumphurst Ltd. PC & Unix consultancy & programming http://www.trumphurst.com/

bryant988 commented 8 years ago

@nikkilocke @jehugaleahsa I went ahead and added the {{#unless}} tag implementation for this in my fork. Also added corresponding unit tests. https://github.com/bryant988/mustache-sharp

After doing this, I wonder if it would be useful to have the #elif opposite equivalent also (#elunless)? I might add that at another time.

nikkilocke commented 8 years ago

Hi Bryant,

Sorry - I'm getting old, and my memory is not what it was :-)

Next time I have some spare time, I will look out the change and bring it up to date.

I will also do the array index change again.

Can you explain exactly how I am supposed to do this (I am not that familiar with github)?

If I clone your repo, does it overwrite the copy I have already cloned? In which case, won't the previous work be lost?

Regards,

Nikki

Nikki Locke, Trumphurst Ltd. PC & Unix consultancy & programming http://www.trumphurst.com/

nikkilocke commented 8 years ago

Hi again, Bryant,

I have searched the repository, and I can't find any record of an unless tag. Sorry.

I do vaguely remember being stymied because I did not know how to handle #unless ... else ... /unless, ans else seemed to be inextricably linked to #if.

Regards,

Nikki

Nikki Locke, Trumphurst Ltd. PC & Unix consultancy & programming http://www.trumphurst.com/

bryant988 commented 8 years ago

@nikkilocke

I have searched the repository, and I can't find any record of an unless tag. Sorry.

I do vaguely remember being stymied because I did not know how to handle #unless ... else ... /unless, and else seemed to be inextricably linked to #if.

If I clone your repo, does it overwrite the copy I have already cloned? In which case, won't the previous work be lost

nikkilocke commented 8 years ago

Sorry, I was misunderstanding - I thought you were talking about some change I had made. I'll shut up now!

Nikki Locke, Trumphurst Ltd. PC & Unix consultancy & programming http://www.trumphurst.com/