You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please provide a way to conditionally render parts of the template where the condition is emptiness / non-emptiness of the list.
Use Case
When rendering lists as HTML, more often than not, it is needed to render parts of the layout only if there are some elements in the list, for example:
Table header and/or footer are only to be shown when there are rows in the table
Heading has to be visible only if there are paragraphs
Ordered and unordered lists might have an introduction and/or conclusion that only need to be shown if there are elements in the list
Proposed Solution
There are two possible ways to implement this functionality:
provide a synthetic property depending on the list emptiness, for example, when reading json. This gives full flexibility how the new key should be named
On the tokenizer level by extending the meaning of positive and negative sections for lists:
<+list>
<h1>Currenty on vacation</h1>
<ul>
<*list><li>{{.}}</li></list>
</ul>
</list>
<-list>Nobody is no vacation now</list>
The second way feels more elegant and will work for manually constructed data models as well.
Other Information
No response
Acknowledgements
I may be able to implement this feature request
This feature might incur a breaking change
Version used
0.2.0
Environment details (OS name and version, etc.)
any
The text was updated successfully, but these errors were encountered:
The list is covered. I believe it might be better to wait for a possibility to iterate over maps to create a meaningful example involving map (non) emptiness.
Describe the feature
Please provide a way to conditionally render parts of the template where the condition is emptiness / non-emptiness of the list.
Use Case
When rendering lists as HTML, more often than not, it is needed to render parts of the layout only if there are some elements in the list, for example:
Proposed Solution
There are two possible ways to implement this functionality:
The second way feels more elegant and will work for manually constructed data models as well.
Other Information
No response
Acknowledgements
Version used
0.2.0
Environment details (OS name and version, etc.)
any
The text was updated successfully, but these errors were encountered: