-
Notifications
You must be signed in to change notification settings - Fork 185
/
Copy pathexample.tmpl
31 lines (30 loc) · 1.6 KB
/
example.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!--
Copyright 2020 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
{{/* . is []*internal/godoc/dochtml.example */}}
{{- define "example" -}}
{{- range . -}}
<details tabindex="-1" id="{{.ID}}" class="Documentation-exampleDetails js-exampleContainer">{{"\n" -}}
<summary class="Documentation-exampleDetailsHeader">Example{{with .Suffix}} ({{.}}){{end}} <a href="#{{.ID}}" aria-label="Go to Example{{with .Suffix}} ({{.}}){{end}}">¶</a></summary>{{"\n" -}}
<div class="Documentation-exampleDetailsBody">{{"\n" -}}
{{- if .Doc -}}{{render_doc .Doc}}{{"\n" -}}{{- end -}}
{{- with play_url .Example -}}
<p><a class="Documentation-examplesPlay" href="{{.}}">Open in Go playground »</a></p>{{"\n" -}}
{{- end -}}
{{render_code .Example}}{{"\n" -}}
{{- if .Output -}}<pre><span class="Documentation-exampleOutputLabel">Output:</span>{{"\n\n"}}<span class="Documentation-exampleOutput">{{- .Output -}}</span></pre>{{"\n" -}}{{- end -}}
</div>{{"\n" -}}
{{- if .Play -}}
<div class="Documentation-exampleButtonsContainer">
<p class="Documentation-exampleError" role="alert" aria-atomic="true"></p>
<button class="Documentation-exampleShareButton" aria-label="Share Code">Share</button>
<button class="Documentation-exampleFormatButton" aria-label="Format Code">Format</button>
<button class="Documentation-exampleRunButton" aria-label="Run Code">Run</button>
</div>
{{- end -}}
</details>{{"\n" -}}
{{"\n"}}
{{- end -}}
{{- end -}}