Closed wesen closed 7 years ago
+1, having to make a new method for checking whether something is empty before iterating over it is quite annoying. (I hope this is what I think it is O_o)
the way i implemented it is actually not for iteration. For iteration, usually, this should work, depending on the truthiness semantics of your implementation language
{{#product}}
Name: {{name}}
{{/product}}
{{^product}}
No products.
{{/product}}
Where is clear that you want to iterate over products. I use the above for things like:
{{?isLoggedIn}}Hello {{user}}.{{^isLoggedIn}}Login{{/isLoggedIn}}
I've implemented the ? tag but didn't do the else. Looks like a reasonable idea to me.
+1
It appears that d5c6d4e does not belong into this pull request.
What was the reason for closing this?
Just closing after 5 years to clean up my open pull request view :)
On Aug 22, 2017, at 1:55 PM, Dennis Schridde notifications@github.com wrote:
What was the reason for closing this?
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/mustache/spec/pull/22#issuecomment-324003823, or mute the thread https://github.com/notifications/unsubscribe-auth/AAH1uYpMQ5448W36uVDOk3kJr0m4en1Pks5sasGwgaJpZM4LwmW5.
Shall I submit the patch in a new pull request?
Sure, go ahead. I’m happy to reopen the pull-requests too if that is easier?
That would probably be easier, yes. Are you still maintaining the specification and do you plan to make changes like these?
Oh I’m not the maintainer of mustache, and in fact I haven’t done any web development in the last 5 years. I don’t see myself working on this any time in the future either.
On Aug 23, 2017, at 1:57 PM, Dennis Schridde notifications@github.com wrote:
That would probably be easier, yes. Are you still maintaining the specification and do you plan to make changes like these?
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/mustache/spec/pull/22#issuecomment-324306566, or mute the thread https://github.com/notifications/unsubscribe-auth/AAH1uSQ7otAOh-hSe4Iw0OZcKdKNahnoks5sbBOegaJpZM4LwmW5.
I'm writing a compiler, and for efficiency purposes (and also template "clarity", in that i can see when a conditional is meant rather than iteration/lambda/new context/conditional), I decided to add a {{?test}} construct that can be used for conditionals. Also allows a kind of shortcut syntax {{?test}}then{{^test}}else{{/test}}.
let me know what you think.