Skip to content

render error for Truthy value #47

@icai

Description

@icai
{% for link in docs %}
        <a href="/{{link.slug}}/" class="_list-item _icon-{{link.slug | split: '~' | first }} _list-dir" title="">
          <img src="/images/docs/{{link.slug | split: '~' | first }}.png" alt=""><span class="name">{{link.name}}{%if link.version and  link.version != '' %}~{{link.version}}{%endif%}
        </span></a>
{% endfor %}

docs data:

[
{"name":"Angular","slug":"angular","type":"angular","links":{"home":"https://angular.io/","code":"https://github.com/angular/angular"},
"version":"","release":"5.0.1","mtime":1510333264,"db_size":8769411},
{"name":"Angular","slug":"angular~4","type":"angular","links":{"home":"https://angular.io/","code":"https://github.com/angular/angular"},
"version":"4","release":"4.4.6","mtime":1510333140,"db_size":8247972}
]

{%if link.version and link.version != '' %}~{{link.version}}{%endif%}

catch error

"version":""
render the ~

may and operator case this, i am not sure.

but the follow is ok.

{%if link.version %}{%if link.version != '' %}~{{link.version}}{%endif%}{%endif%}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions