template.html (2027B)
1 <!--suppress HtmlUnknownAttribute, HtmlUnknownTag --> 2 3 <import> 4 "path" 5 </import> 6 7 <interface class="Page"> 8 Title(w tpls.Writer) 9 Body(w tpls.Writer) 10 </interface> 11 12 <template class="Render(p Page)"> 13 <!doctype html> 14 <html lang="en"> 15 <head> 16 <meta charset="UTF-8"> 17 <meta name="viewport" 18 content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> 19 <meta http-equiv="X-UA-Compatible" content="ie=edge"> 20 21 <title> 22 p.Title(w) 23 </title> 24 </head> 25 <body> 26 <raw>p.Body(w)</raw> 27 </body> 28 </html> 29 </template> 30 31 <struct class="MainPage"> 32 Name string 33 Cond int 34 </struct> 35 36 <template class="(*MainPage) Title()"> 37 Main Page 38 </template> 39 40 <template class="(p *MainPage) Body()"> 41 <card>Custom Card!</card> 42 <card></card> 43 <p> 44 Strings:<br> 45 Hello, <string>"World"</string>!<br> 46 <string class="unsafe"> 47 `<a href="http://example.com">Unsafe String</a>`</string><br> 48 <string class="bytes">[]byte{72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33}</string><br> 49 <string>path.Join("/path", "./to/file")</string> 50 </p> 51 <p> 52 Numbers:<br> 53 <integer>123</integer><br> 54 <float>123.45</float><br> 55 <float class="1">123.45</float> 56 </p> 57 <p> 58 If:<br> 59 <if class="p.Cond == 1"> 60 <then> 61 p.Cond is 1 62 </then> 63 <else class="p.Cond == 2"> 64 p.Cond is 2 65 </else> 66 <else> 67 else. 68 </else> 69 </if> 70 </p> 71 <p> 72 Loop:<br> 73 <for class="_, s := range []string{ `a`, `b`, `c` }"> 74 <string>s</string><br> 75 </for> 76 </p> 77 <raw>theValue := "value"</raw> 78 <p> 79 Binding:<br> 80 <a :href="path.Join(`/path/to`, theValue)"><string>theValue</string></a> 81 </p> 82 </template>