github.com/servernoj/jade@v0.0.0-20231225191405-efec98d19db1/testdata/v2/conditionals.tpl (about) 1 {{/* 2 var user = struct{ 3 description, name string 4 isAnonymous bool 5 }{ description: "foo bar baz", name: "zxc" } */}}{{/* var authorised = false */}} 6 <div id="user">{{ if len(user.description) > 0 }} 7 <h2 class="green">Description</h2> 8 <p class="description">{{ user.description }}</p> 9 {{ else if authorised }} 10 <h2 class="blue">Description</h2> 11 <p class="description"> 12 User has no description, 13 why not add one... 14 </p> 15 {{ else }} 16 <h2 class="red">Description</h2> 17 <p class="description">User has no description</p> 18 {{ end }} 19 </div> 20 {{ if not user.isAnonymous }} 21 <p>You're logged in as {{ user.name }}</p> 22 {{ end }}{{ if !user.isAnonymous }} 23 <p>You're logged in as {{ user.name }}</p> 24 {{ end }}