This is a question about Mustache syntax. I'm using clostache but I don't think that makes a difference.
The 'Section' operator appears to be overloaded to mean
if the bound value is boolean, it means
if
, but if it's a list it meansloop
What if I want to show a section if a value is non-false but not iterate? For example (creating an example operator with a %
character)
{{%people}}
<p>There are people. Here they are:</p>
<ul>
{{#people}}<li>{{name}}</li>{{/people}
{{/people}}
This seems like a very common use case but I can't obviously see the syntax for it. How do I accomplish this?
Unfortunately what you've described is not possible. In your JS code you must create a new section for the title and set it to true
if the length of people
is greater than 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With