github.com/servernoj/jade@v0.0.0-20231225191405-efec98d19db1/testdata/v2/mixins.tpl (about) 1 <ul> 2 <li>foo</li> 3 <li>bar</li> 4 <li>baz</li> 5 </ul> 6 <ul> 7 <li>foo</li> 8 <li>bar</li> 9 <li>baz</li> 10 </ul> 11 <ul>{{ $name := "cat" }} 12 <li class="pet">{{ name }}</li> 13 {{ $name := "dog" }} 14 <li class="pet">{{ name }}</li> 15 {{ $name := "pig" }} 16 <li class="pet">{{ name }}</li> 17 </ul> 18 {{ $title := "Hello world" }} 19 <div class="article"> 20 <div class="article-wrapper"> 21 <h1>{{ title }}</h1> 22 {{ if len(block) > 0 }}{{/* block */}}{{ else }} 23 <p>No content provided</p> 24 {{ end }} 25 </div> 26 </div> 27 {{ $title := "Hello world" }} 28 <p>This is my</p> 29 <p>Amazing article</p> 30 <div class="article"> 31 <div class="article-wrapper"> 32 <h1>{{ title }}</h1> 33 {{ if len(block) > 0 }}{{/* block */}}{{ else }} 34 <p>No content provided</p> 35 {{ end }} 36 </div> 37 </div> 38 {{ $href := "/foo" }}{{ $name := "foo" }} 39 {{/* attributes := struct{class string}{class: "btn"} */}} 40 <a class="{{ print attributes.class }}" href="{{ print href }}">{{ name }}</a> 41 {{ $href := fn("/foo", "bar", "baz") }}{{ $name := "foo" }} 42 {{/* attributes := struct{class string}{class: "btn"} */}} 43 <a class="{{ print attributes.class }}" href="{{ print href }}">{{ name }}</a> 44 {{ $href := "/foo" }}{{ $name := "foo" }} 45 <a href="{{ print href }}">{{ name }}</a> 46 {{ $title := "Default Title" }} 47 <div class="article"> 48 <div class="article-wrapper"> 49 <h1>{{ title }}</h1> 50 </div> 51 </div> 52 {{ $title := "Hello world" }} 53 <div class="article"> 54 <div class="article-wrapper"> 55 <h1>{{ title }}</h1> 56 </div> 57 </div> 58 <!-- TODO for string --> 59 {{ $items := []string{"\"string\"", "2", "3.5", "4"} }}{{ $id := fn("my-list") }} 60 <ul id="{{ print id }}">{{/* _, item */}}{{ range items }} 61 <li>{{ item }}</li> 62 {{ end }} 63 </ul>