To clarify. If the object you inject has a value which either does not contain the key twitter or it does container the key twitter but its value is nil then the section won't be shown. '{{#twitter}} <tr> <td class="mdl-data-table__cell--non-numeric"><b>Twitter</b></td> <td class="mdl-data-table__cell--non-numeric"> <a href="https://twitter.com/{{twitter}}">{{twitter}}</a></td> </tr> {{/twitter}}' asMustacheTemplate value: { #twitter -> nil } asDictionary gives empty string in my case. Norbert
Am 29.05.2017 um 16:20 schrieb Norbert Hartl <norbert@hartl.name>:
Can you show some data you are injecting? It should work as you expect it.
Norbert
Am 29.05.2017 um 15:26 schrieb Offray Vladimir Luna Cárdenas <offray.luna@mutabit.com>:
Hi,
I'm using Mustache for a project to build a dynamic distributed web site generator for public & open data, backed by Fossil and using Material Design Lite. I have a template like this:
========
{{#twitter}} <tr> <td class="mdl-data-table__cell--non-numeric"><b>Twitter</b></td> <td class="mdl-data-table__cell--non-numeric"> <a href="https://twitter.com/{{twitter}}">{{twitter}}</a></td> </tr> {{/twitter}}
========
that is mean to show or hide a row in a table, depending on if Twitter data for a profile is found in a user profile. When the profile doesn't have twitter data, the row is hidden, as supposed, and when it has, the row is shown, but without any actual twitter data. What I'm missing? Should I use partials in this case and how?
Thanks,
Offray