ActiveCampaign / mustachio

Lightweight, powerful, flavorful, template engine.
MIT License
207 stars 17 forks source link

Cannot use Inverted Group inside Inverted Group. #33

Closed iampava closed 3 years ago

iampava commented 3 years ago

I'm trying to render some default text in case neither of two variables exists. I expected this to work, but it doesn't. Am I missing something or is this not supported?

{{^foo}}
  {{^bar}}  foo and bar are both missing {{/bar}}
{{/foo}}
sethaniel commented 3 years ago

for bar to exist without foo, they would have to exist at independent levels. Since your test for foo set your current context to there, it's looking for bar as a child of foo. Try changing {{^bar}} to {{^ ../bar}}

iampava commented 3 years ago

Thanks, indeed it works like this. Will close the issue 🙏