diff options
Diffstat (limited to 'lib/godoc/example.html')
-rw-r--r-- | lib/godoc/example.html | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/godoc/example.html b/lib/godoc/example.html index ede31d61f..cda2a8491 100644 --- a/lib/godoc/example.html +++ b/lib/godoc/example.html @@ -5,11 +5,24 @@ <div class="expanded"> <p class="exampleHeading toggleButton">▾ <span class="text">Example{{example_suffix .Name}}</span></p> {{with .Doc}}<p>{{html .}}</p>{{end}} - <p>Code:</p> - <pre class="code">{{.Code}}</pre> - {{with .Output}} - <p>Output:</p> - <pre class="output">{{html .}}</pre> + {{$output := .Output}} + {{with .Play}} + <div class="play"> + <div class="input"><textarea class="code">{{html .}}</textarea></div> + <div class="output"><pre>{{html $output}}</pre></div> + <div class="buttons"> + <a class="run" title="Run this code [shift-enter]">Run</a> + <a class="fmt" title="Format this code">Format</a> + <a class="share" title="Share this code">Share</a> + </div> + </div> + {{else}} + <p>Code:</p> + <pre class="code">{{.Code}}</pre> + {{with .Output}} + <p>Output:</p> + <pre class="output">{{html .}}</pre> + {{end}} {{end}} </div> </div> |