page.html (1777B)
1 {{ $pkg := .Params.package}} 2 {{ $funcs := index site.Data.docs.tpl.funcs $pkg }} 3 4 {{ range $k, $v := $funcs }} 5 {{ if $v.Description }} 6 {{ $func := printf "%s.%s" $pkg $k }} 7 {{ $id := $func | anchorize | safeURL }} 8 <h2 id="{{ $id }}"> 9 <a class="header-link" href="#{{ $id }}"> 10 <svg class="fill-current o-60 hover-accent-color-light" height="22px" viewBox="0 0 24 24" width="22px" xmlns="http://www.w3.org/2000/svg"> 11 <path d="M0 0h24v24H0z" fill="none"/> 12 <path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/> 13 </svg> 14 </a> 15 {{ $func }} 16 </h2> 17 {{ with $v.Description }} 18 <p class="f4 lh-copy"> 19 {{ . | $.RenderString | safeHTML }} 20 </p> 21 {{ end }} 22 <h4 class="minor mb3 pt2 primary-color-dark"> 23 Syntax 24 </h4> 25 <div class="f5 mb4 ph3 pv2 bg-light-gray" style="border-left:4px solid #0594CB;"> 26 {{ $pkg }}.{{ $k }} 27 {{ with $v.Args }} 28 <span class="ttu"> 29 {{ delimit $v.Args ", "}} 30 </span> 31 {{ end }} 32 <span></span> 33 </div> 34 {{ if $v.Examples }} 35 <h4 class="minor mb3 pt2 primary-color-dark"> 36 Examples 37 </h4> 38 {{ end }} 39 {{ range $v.Examples }} 40 {{ $input := index . 0 }} 41 {{ $result := index . 1 }} 42 {{ $example := printf "%s ---> %s" $input $result }} 43 44 {{ highlight $example "go-html-template" "" }} 45 {{ end }} 46 {{ with $v.Aliases }} 47 <h4 class="minor mb3 pt2 primary-color-dark"> 48 Aliases 49 </h4> 50 <p> 51 {{ delimit . ", "}} 52 </p> 53 {{ end }} 54 {{ end }} 55 {{ end }}