Replies: 4 comments 6 replies
-
I make extensive use of this, and I've seen a number of requests (see #157 (comment) for links to some requests) for this functionality (even if not this syntax). Typically used to avoid including html content for a section or even boiler plate for a table so as to avoid an empty table body. My primary use case is omitting entire sections, not just the table boilerplate. Whilst I like this syntax, I'm not wedded to it. I could happily use an alternative syntax based on census in #157 |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Here are 3 uses that I've cobbled together from some real use cases I have at work: variables
Template
Rendered Output
I do like the
I'd rather the proposed I feel more experienced with Mustache when I first wrote that code sample above so I'd likely not write a template in that style BUT for the list examples I do need a plain not exists (not falsey) check. |
Beta Was this translation helpful? Give feedback.
-
VS
VS
imo, the third is the best one.
where |
Beta Was this translation helpful? Give feedback.
-
Option 3 in #157 in Stache for Python.
Copy/paste extract from readme:
Existence Check {{?exists}}{{/}}
See #157
Forces a check of the tag name, rather than imply that it is a section block. This
is useful for check if an array has members rather than iterate over the members
with
{array: [1, 2, 3, 4]}
results in:as opposed to
which would render
I can't claim any ownership of this, this was implemented in https://github.com/hyperturtle/Stache by hyperturtle, more about my fork #172
Beta Was this translation helpful? Give feedback.
All reactions