blob: 2ea12de243b6c22cf83803f0cccc6a928758bc7d [file] [log] [blame]
<!--
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.
-->
{{- 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}}"></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 -}}
<p>Code:</p>{{"\n" -}}
{{render_code .Example}}{{"\n" -}}
{{- if (or .Output .EmptyOutput) -}}
<pre class="Documentation-exampleOutput">{{"\n"}}{{.Output}}</pre>{{"\n" -}}
{{- end -}}
</div>{{"\n" -}}
{{- if .Play -}}
<div class="Documentation-exampleButtonsContainer">
<p class="Documentation-exampleError" role="alert" aria-atomic="true"></p>
<button class="Documentation-examplePlayButton" aria-label="Play Code">Play</button>
</div>
{{- end -}}
</details>{{"\n" -}}
{{"\n"}}
{{- end -}}
{{- end -}}