2013-08-15 19:44:27 -06:00
|
|
|
// DO NOT EDIT ** This file was generated with the bake tool ** DO NOT EDIT //
|
|
|
|
|
2013-08-20 21:49:05 -06:00
|
|
|
package static
|
2013-08-15 19:44:27 -06:00
|
|
|
|
2013-08-20 21:49:05 -06:00
|
|
|
var Files = map[string]string{
|
2013-08-15 19:44:27 -06:00
|
|
|
"codewalk.html": `<!--
|
|
|
|
Copyright 2010 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.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<style type='text/css'>@import "/doc/codewalk/codewalk.css";</style>
|
|
|
|
<script type="text/javascript" src="/doc/codewalk/codewalk.js"></script>
|
|
|
|
|
|
|
|
<div id="codewalk-main">
|
|
|
|
<div class="left" id="code-column">
|
|
|
|
<div id='sizer'></div>
|
|
|
|
<div id="code-area">
|
|
|
|
<div id="code-header" align="center">
|
|
|
|
<a id="code-popout-link" href="" target="_blank">
|
|
|
|
<img title="View code in new window" alt="Pop Out Code" src="/doc/codewalk/popout.png" style="display: block; float: right;"/>
|
|
|
|
</a>
|
|
|
|
<select id="code-selector">
|
|
|
|
{{range .File}}
|
|
|
|
<option value="/doc/codewalk/?fileprint=/{{urlquery .}}">{{html .}}</option>
|
|
|
|
{{end}}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div id="code">
|
|
|
|
<iframe class="code-display" name="code-display" id="code-display"></iframe>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="code-options" class="setting">
|
|
|
|
<span>code on <a id="set-code-left" class="selected" href="#">left</a> • <a id="set-code-right" href="#">right</a></span>
|
|
|
|
<span>code width <span id="code-column-width">70%</span></span>
|
|
|
|
<span>filepaths <a id="show-filepaths" class="selected" href="#">shown</a> • <a id="hide-filepaths" href="#">hidden</a></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="right" id="comment-column">
|
|
|
|
<div id="comment-area">
|
|
|
|
{{range .Step}}
|
|
|
|
<div class="comment first last">
|
2013-10-13 20:22:48 -06:00
|
|
|
<a class="comment-link" href="/doc/codewalk/?fileprint=/{{urlquery .File}}&lo={{urlquery .Lo}}&hi={{urlquery .Hi}}#mark" target="code-display"></a>
|
2013-08-15 19:44:27 -06:00
|
|
|
<div class="comment-title">{{html .Title}}</div>
|
|
|
|
<div class="comment-text">
|
|
|
|
{{with .Err}}
|
|
|
|
ERROR LOADING FILE: {{html .}}<br/><br/>
|
|
|
|
{{end}}
|
|
|
|
{{.XML}}
|
|
|
|
</div>
|
|
|
|
<div class="comment-text file-name"><span class="path-file">{{html .}}</span></div>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
<div id="comment-options" class="setting">
|
|
|
|
<a id="prev-comment" href="#"><span class="hotkey">p</span>revious step</a>
|
|
|
|
•
|
|
|
|
<a id="next-comment" href="#"><span class="hotkey">n</span>ext step</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
`,
|
|
|
|
"codewalkdir.html": `<!--
|
|
|
|
Copyright 2010 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.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<table class="layout">
|
|
|
|
{{range .}}
|
|
|
|
<tr>
|
|
|
|
{{$name_html := html .Name}}
|
|
|
|
<td><a href="{{$name_html}}">{{$name_html}}</a></td>
|
|
|
|
<td width="25"> </td>
|
|
|
|
<td>{{html .Title}}</td>
|
|
|
|
</tr>
|
|
|
|
{{end}}
|
|
|
|
</table>
|
|
|
|
`,
|
|
|
|
"dirlist.html": `<!--
|
|
|
|
Copyright 2009 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.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<table class="layout">
|
|
|
|
<tr>
|
|
|
|
<th align="left">File</th>
|
|
|
|
<td width="25"> </td>
|
|
|
|
<th align="right">Bytes</th>
|
|
|
|
<td width="25"> </td>
|
|
|
|
<th align="left">Modified</th>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><a href="..">..</a></td>
|
|
|
|
</tr>
|
|
|
|
{{range .}}
|
|
|
|
<tr>
|
|
|
|
{{$name_html := fileInfoName . | html}}
|
|
|
|
<td align="left"><a href="{{$name_html}}">{{$name_html}}</a></td>
|
|
|
|
<td></td>
|
|
|
|
<td align="right">{{html .Size}}</td>
|
|
|
|
<td></td>
|
|
|
|
<td align="left">{{fileInfoTime . | html}}</td>
|
|
|
|
</tr>
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
</table>
|
|
|
|
</p>
|
|
|
|
`,
|
|
|
|
"error.html": `<!--
|
|
|
|
Copyright 2009 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.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<span class="alert" style="font-size:120%">{{html .}}</span>
|
|
|
|
</p>
|
|
|
|
`,
|
|
|
|
"example.html": `<div id="example_{{.Name}}" class="toggle">
|
|
|
|
<div class="collapsed">
|
|
|
|
<p class="exampleHeading toggleButton">▹ <span class="text">Example{{example_suffix .Name}}</span></p>
|
|
|
|
</div>
|
|
|
|
<div class="expanded">
|
|
|
|
<p class="exampleHeading toggleButton">▾ <span class="text">Example{{example_suffix .Name}}</span></p>
|
|
|
|
{{with .Doc}}<p>{{html .}}</p>{{end}}
|
|
|
|
{{$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>
|
|
|
|
`,
|
|
|
|
"godoc.html": `<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
|
{{with .Tabtitle}}
|
|
|
|
<title>{{html .}} - The Go Programming Language</title>
|
|
|
|
{{else}}
|
|
|
|
<title>The Go Programming Language</title>
|
|
|
|
{{end}}
|
|
|
|
<link type="text/css" rel="stylesheet" href="/lib/godoc/style.css">
|
|
|
|
{{if .SearchBox}}
|
|
|
|
<link rel="search" type="application/opensearchdescription+xml" title="godoc" href="/opensearch.xml" />
|
|
|
|
{{end}}
|
|
|
|
<script type="text/javascript">window.initFuncs = [];</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div id="topbar"{{if .Title}} class="wide"{{end}}><div class="container">
|
|
|
|
|
|
|
|
<form method="GET" action="/search">
|
|
|
|
<div id="menu">
|
|
|
|
<a href="/doc/">Documents</a>
|
|
|
|
<a href="/pkg/">Packages</a>
|
|
|
|
<a href="/project/">The Project</a>
|
|
|
|
<a href="/help/">Help</a>
|
2013-09-17 23:12:51 -06:00
|
|
|
<a href="/blog/">Blog</a>
|
2013-08-15 19:44:27 -06:00
|
|
|
{{if .Playground}}
|
|
|
|
<a id="playgroundButton" href="http://play.golang.org/" title="Show Go Playground">Play</a>
|
|
|
|
{{end}}
|
|
|
|
<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search">
|
|
|
|
</div>
|
|
|
|
<div id="heading"><a href="/">The Go Programming Language</a></div>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
</div></div>
|
|
|
|
|
|
|
|
{{if .Playground}}
|
|
|
|
<div id="playground" class="play">
|
|
|
|
<div class="input"><textarea class="code">package main
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
fmt.Println("Hello, 世界")
|
|
|
|
}</textarea></div>
|
|
|
|
<div class="output"></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>
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
<div id="page"{{if .Title}} class="wide"{{end}}>
|
|
|
|
<div class="container">
|
|
|
|
|
|
|
|
{{with .Title}}
|
|
|
|
<div id="plusone"><g:plusone size="small" annotation="none"></g:plusone></div>
|
|
|
|
<h1>{{html .}}</h1>
|
|
|
|
{{end}}
|
|
|
|
{{with .Subtitle}}
|
|
|
|
<h2>{{html .}}</h2>
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{/* The Table of Contents is automatically inserted in this <div>.
|
|
|
|
Do not delete this <div>. */}}
|
|
|
|
<div id="nav"></div>
|
|
|
|
|
|
|
|
{{/* Body is HTML-escaped elsewhere */}}
|
|
|
|
{{printf "%s" .Body}}
|
|
|
|
|
|
|
|
<div id="footer">
|
|
|
|
Build version {{html .Version}}.<br>
|
|
|
|
Except as <a href="http://code.google.com/policies.html#restrictions">noted</a>,
|
|
|
|
the content of this page is licensed under the
|
|
|
|
Creative Commons Attribution 3.0 License,
|
|
|
|
and code is licensed under a <a href="/LICENSE">BSD license</a>.<br>
|
|
|
|
<a href="/doc/tos.html">Terms of Service</a> |
|
|
|
|
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div><!-- .container -->
|
|
|
|
</div><!-- #page -->
|
|
|
|
|
|
|
|
<script type="text/javascript" src="/lib/godoc/jquery.js"></script>
|
|
|
|
{{if .Playground}}
|
|
|
|
<script type="text/javascript" src="/lib/godoc/playground.js"></script>
|
|
|
|
{{end}}
|
|
|
|
<script type="text/javascript" src="/lib/godoc/godocs.js"></script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|
|
|
|
`,
|
|
|
|
"godocs.js": `// Copyright 2012 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.
|
|
|
|
|
|
|
|
/* A little code to ease navigation of these documents.
|
|
|
|
*
|
|
|
|
* On window load we:
|
|
|
|
* + Bind search box hint placeholder show/hide events (bindSearchEvents)
|
|
|
|
* + Generate a table of contents (generateTOC)
|
|
|
|
* + Bind foldable sections (bindToggles)
|
|
|
|
* + Bind links to foldable sections (bindToggleLinks)
|
|
|
|
*/
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
function bindSearchEvents() {
|
|
|
|
|
|
|
|
var search = $('#search');
|
|
|
|
if (search.length === 0) {
|
|
|
|
return; // no search box
|
|
|
|
}
|
|
|
|
|
|
|
|
function clearInactive() {
|
|
|
|
if (search.is('.inactive')) {
|
|
|
|
search.val('');
|
|
|
|
search.removeClass('inactive');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function restoreInactive() {
|
|
|
|
if (search.val() !== '') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
search.val(search.attr('placeholder'));
|
|
|
|
search.addClass('inactive');
|
|
|
|
}
|
|
|
|
|
|
|
|
search.on('focus', clearInactive);
|
|
|
|
search.on('blur', restoreInactive);
|
|
|
|
|
|
|
|
restoreInactive();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Generates a table of contents: looks for h2 and h3 elements and generates
|
|
|
|
* links. "Decorates" the element with id=="nav" with this table of contents.
|
|
|
|
*/
|
|
|
|
function generateTOC() {
|
|
|
|
if ($('#manual-nav').length > 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var nav = $('#nav');
|
|
|
|
if (nav.length === 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var toc_items = [];
|
|
|
|
$(nav).nextAll('h2, h3').each(function() {
|
|
|
|
var node = this;
|
|
|
|
if (node.id == '')
|
|
|
|
node.id = 'tmp_' + toc_items.length;
|
|
|
|
var link = $('<a/>').attr('href', '#' + node.id).text($(node).text());
|
|
|
|
var item;
|
|
|
|
if ($(node).is('h2')) {
|
|
|
|
item = $('<dt/>');
|
|
|
|
} else { // h3
|
|
|
|
item = $('<dd/>');
|
|
|
|
}
|
|
|
|
item.append(link);
|
|
|
|
toc_items.push(item);
|
|
|
|
});
|
|
|
|
if (toc_items.length <= 1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var dl1 = $('<dl/>');
|
|
|
|
var dl2 = $('<dl/>');
|
|
|
|
|
|
|
|
var split_index = (toc_items.length / 2) + 1;
|
|
|
|
if (split_index < 8) {
|
|
|
|
split_index = toc_items.length;
|
|
|
|
}
|
|
|
|
for (var i = 0; i < split_index; i++) {
|
|
|
|
dl1.append(toc_items[i]);
|
|
|
|
}
|
|
|
|
for (/* keep using i */; i < toc_items.length; i++) {
|
|
|
|
dl2.append(toc_items[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
var tocTable = $('<table class="unruled"/>').appendTo(nav);
|
|
|
|
var tocBody = $('<tbody/>').appendTo(tocTable);
|
|
|
|
var tocRow = $('<tr/>').appendTo(tocBody);
|
|
|
|
|
|
|
|
// 1st column
|
|
|
|
$('<td class="first"/>').appendTo(tocRow).append(dl1);
|
|
|
|
// 2nd column
|
|
|
|
$('<td/>').appendTo(tocRow).append(dl2);
|
|
|
|
}
|
|
|
|
|
|
|
|
function bindToggle(el) {
|
|
|
|
$('.toggleButton', el).click(function() {
|
|
|
|
if ($(el).is('.toggle')) {
|
|
|
|
$(el).addClass('toggleVisible').removeClass('toggle');
|
|
|
|
} else {
|
|
|
|
$(el).addClass('toggle').removeClass('toggleVisible');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function bindToggles(selector) {
|
|
|
|
$(selector).each(function(i, el) {
|
|
|
|
bindToggle(el);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function bindToggleLink(el, prefix) {
|
|
|
|
$(el).click(function() {
|
|
|
|
var href = $(el).attr('href');
|
|
|
|
var i = href.indexOf('#'+prefix);
|
|
|
|
if (i < 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var id = '#' + prefix + href.slice(i+1+prefix.length);
|
|
|
|
if ($(id).is('.toggle')) {
|
|
|
|
$(id).find('.toggleButton').first().click();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function bindToggleLinks(selector, prefix) {
|
|
|
|
$(selector).each(function(i, el) {
|
|
|
|
bindToggleLink(el, prefix);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function setupDropdownPlayground() {
|
|
|
|
if (!$('#page').is('.wide')) {
|
|
|
|
return; // don't show on front page
|
|
|
|
}
|
|
|
|
var button = $('#playgroundButton');
|
|
|
|
var div = $('#playground');
|
|
|
|
var setup = false;
|
|
|
|
button.toggle(function() {
|
|
|
|
button.addClass('active');
|
|
|
|
div.show();
|
|
|
|
if (setup) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
setup = true;
|
|
|
|
playground({
|
|
|
|
'codeEl': $('.code', div),
|
|
|
|
'outputEl': $('.output', div),
|
|
|
|
'runEl': $('.run', div),
|
|
|
|
'fmtEl': $('.fmt', div),
|
|
|
|
'shareEl': $('.share', div),
|
|
|
|
'shareRedirect': 'http://play.golang.org/p/'
|
|
|
|
});
|
|
|
|
},
|
|
|
|
function() {
|
|
|
|
button.removeClass('active');
|
|
|
|
div.hide();
|
|
|
|
});
|
|
|
|
button.show();
|
|
|
|
$('#menu').css('min-width', '+=60');
|
|
|
|
}
|
|
|
|
|
|
|
|
function setupInlinePlayground() {
|
|
|
|
'use strict';
|
|
|
|
// Set up playground when each element is toggled.
|
|
|
|
$('div.play').each(function (i, el) {
|
|
|
|
// Set up playground for this example.
|
|
|
|
var setup = function() {
|
|
|
|
var code = $('.code', el);
|
|
|
|
playground({
|
|
|
|
'codeEl': code,
|
|
|
|
'outputEl': $('.output', el),
|
|
|
|
'runEl': $('.run', el),
|
|
|
|
'fmtEl': $('.fmt', el),
|
|
|
|
'shareEl': $('.share', el),
|
|
|
|
'shareRedirect': 'http://play.golang.org/p/'
|
|
|
|
});
|
|
|
|
|
|
|
|
// Make the code textarea resize to fit content.
|
|
|
|
var resize = function() {
|
|
|
|
code.height(0);
|
|
|
|
var h = code[0].scrollHeight;
|
|
|
|
code.height(h+20); // minimize bouncing.
|
|
|
|
code.closest('.input').height(h);
|
|
|
|
};
|
|
|
|
code.on('keydown', resize);
|
|
|
|
code.on('keyup', resize);
|
|
|
|
code.keyup(); // resize now.
|
|
|
|
};
|
|
|
|
|
|
|
|
// If example already visible, set up playground now.
|
|
|
|
if ($(el).is(':visible')) {
|
|
|
|
setup();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Otherwise, set up playground when example is expanded.
|
|
|
|
var built = false;
|
|
|
|
$(el).closest('.toggle').click(function() {
|
|
|
|
// Only set up once.
|
|
|
|
if (!built) {
|
|
|
|
setup();
|
|
|
|
built = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// fixFocus tries to put focus to div#page so that keyboard navigation works.
|
|
|
|
function fixFocus() {
|
|
|
|
var page = $('div#page');
|
|
|
|
var topbar = $('div#topbar');
|
|
|
|
page.css('outline', 0); // disable outline when focused
|
|
|
|
page.attr('tabindex', -1); // and set tabindex so that it is focusable
|
|
|
|
$(window).resize(function (evt) {
|
|
|
|
// only focus page when the topbar is at fixed position (that is, it's in
|
|
|
|
// front of page, and keyboard event will go to the former by default.)
|
|
|
|
// by focusing page, keyboard event will go to page so that up/down arrow,
|
|
|
|
// space, etc. will work as expected.
|
|
|
|
if (topbar.css('position') == "fixed")
|
|
|
|
page.focus();
|
|
|
|
}).resize();
|
|
|
|
}
|
|
|
|
|
|
|
|
function toggleHash() {
|
|
|
|
var hash = $(window.location.hash);
|
|
|
|
if (hash.is('.toggle')) {
|
|
|
|
hash.find('.toggleButton').first().click();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function addPlusButtons() {
|
|
|
|
var po = document.createElement('script');
|
|
|
|
po.type = 'text/javascript';
|
|
|
|
po.async = true;
|
2013-10-29 20:13:42 -06:00
|
|
|
po.src = 'https://apis.google.com/js/platform.js';
|
2013-08-15 19:44:27 -06:00
|
|
|
var s = document.getElementsByTagName('script')[0];
|
|
|
|
s.parentNode.insertBefore(po, s);
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
bindSearchEvents();
|
|
|
|
generateTOC();
|
|
|
|
bindToggles(".toggle");
|
|
|
|
bindToggles(".toggleVisible");
|
|
|
|
bindToggleLinks(".exampleLink", "example_");
|
|
|
|
bindToggleLinks(".overviewLink", "");
|
|
|
|
bindToggleLinks(".examplesLink", "");
|
|
|
|
bindToggleLinks(".indexLink", "");
|
|
|
|
setupDropdownPlayground();
|
|
|
|
setupInlinePlayground();
|
|
|
|
fixFocus();
|
|
|
|
toggleHash();
|
|
|
|
addPlusButtons();
|
|
|
|
|
|
|
|
// godoc.html defines window.initFuncs in the <head> tag, and root.html and
|
|
|
|
// codewalk.js push their on-page-ready functions to the list.
|
|
|
|
// We execute those functions here, to avoid loading jQuery until the page
|
|
|
|
// content is loaded.
|
|
|
|
for (var i = 0; i < window.initFuncs.length; i++) window.initFuncs[i]();
|
|
|
|
});
|
|
|
|
|
|
|
|
})();
|
|
|
|
`,
|
|
|
|
"jquery.js": `/*! jQuery v1.8.2 jquery.com | jquery.org/license */
|
|
|
|
(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)p.event.add(b,c,h[c][d])}g.data&&(g.data=p.extend({},g.data))}function bE(a,b){var c;if(b.nodeType!==1)return;b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?(b.parentNode&&(b.outerHTML=a.outerHTML),p.support.html5Clone&&a.innerHTML&&!p.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):c==="input"&&bv.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(p.expando)}function bF(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bG(a){bv.test(a.type)&&(a.defaultChecked=a.checked)}function bY(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=bW.length;while(e--){b=bW[e]+c;if(b in a)return b}return d}function bZ(a,b){return a=b||a,p.css(a,"display")==="none"||!p.contains(a.ownerDocument,a)}function b$(a,b){var c,d,e=[],f=0,g=a.length;for(;f<g;f++){c=a[f];if(!c.style)continue;e[f]=p._data(c,"olddisplay"),b?(!e[f]&&c.style.display==="none"&&(c.style.display=""),c.style.display===""&&bZ(c)&&(e[f]=p._data(c,"olddisplay",cc(c.nodeName)))):(d=bH(c,"display"),!e[f]&&d!=="none"&&p._data(c,"olddisplay",d))}for(f=0;f<g;f++){c=a[f];if(!c.style)continue;if(!b||c.style.display==="none"||c.style.display==="")c.style.display=b?e[f]||"":"none"}return a}function b_(a,b,c){var d=bP.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function ca(a,b,c,d){var e=c===(d?"border":"content")?4:b==="width"?1:0,f=0;for(;e<4;e+=2)c==="margin"&&(f+=p.css(a,c+bV[e],!0)),d?(c==="content"&&(f-=parseFloat(bH(a,"padding"+bV[e]))||0),c!=="margin"&&(f-=parseFloat(bH(a,"border"+bV[e]+"Width"))||0)):(f+=parseFloat(bH(a,"padding"+bV[e]))||0,c!=="padding"&&(f+=parseFloat(bH(a,"border"+bV[e]+"Width"))||0));return f}function cb(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=!0,f=p.support.boxSizing&&p.css(a,"boxSizing")==="border-box";if(d<=0||d==null){d=bH(a,b);if(d<0||d==null)d=a.style[b];if(bQ.test(d))return d;e=f&&(p.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+ca(a,b,c||(f?"border":"content"),e)+"px"}function cc(a){if(bS[a])return bS[a];var b=p("<"+a+">").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write("<!doctype html><html><body>"),bJ
|
|
|
|
"opensearch.xml": `<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
|
|
|
|
<ShortName>godoc</ShortName>
|
|
|
|
<Description>The Go Programming Language</Description>
|
|
|
|
<Tags>go golang</Tags>
|
|
|
|
<Contact />
|
|
|
|
<Url type="text/html" template="{{.BaseURL}}/search?q={searchTerms}" />
|
|
|
|
<Image height="15" width="16" type="image/x-icon">/favicon.ico</Image>
|
|
|
|
<OutputEncoding>UTF-8</OutputEncoding>
|
|
|
|
<InputEncoding>UTF-8</InputEncoding>
|
|
|
|
</OpenSearchDescription>
|
|
|
|
`,
|
|
|
|
"package.html": `<!--
|
|
|
|
Copyright 2009 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.
|
|
|
|
-->
|
|
|
|
<!--
|
|
|
|
Note: Static (i.e., not template-generated) href and id
|
|
|
|
attributes start with "pkg-" to make it impossible for
|
|
|
|
them to conflict with generated attributes (some of which
|
|
|
|
correspond to Go identifiers).
|
|
|
|
-->
|
|
|
|
{{with .PDoc}}
|
|
|
|
{{if $.IsMain}}
|
|
|
|
{{/* command documentation */}}
|
|
|
|
{{comment_html .Doc}}
|
|
|
|
{{else}}
|
|
|
|
{{/* package documentation */}}
|
|
|
|
<div id="short-nav">
|
|
|
|
<dl>
|
|
|
|
<dd><code>import "{{html .ImportPath}}"</code></dd>
|
|
|
|
</dl>
|
|
|
|
<dl>
|
|
|
|
<dd><a href="#pkg-overview" class="overviewLink">Overview</a></dd>
|
|
|
|
<dd><a href="#pkg-index" class="indexLink">Index</a></dd>
|
|
|
|
{{if $.Examples}}
|
|
|
|
<dd><a href="#pkg-examples" class="examplesLink">Examples</a></dd>
|
|
|
|
{{end}}
|
|
|
|
{{if $.Dirs}}
|
|
|
|
<dd><a href="#pkg-subdirectories">Subdirectories</a></dd>
|
|
|
|
{{end}}
|
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
<!-- The package's Name is printed as title by the top-level template -->
|
|
|
|
<div id="pkg-overview" class="toggleVisible">
|
|
|
|
<div class="collapsed">
|
|
|
|
<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
|
|
|
|
</div>
|
|
|
|
<div class="expanded">
|
|
|
|
<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
|
|
|
|
{{comment_html .Doc}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{example_html $ ""}}
|
|
|
|
|
|
|
|
<div id="pkg-index" class="toggleVisible">
|
|
|
|
<div class="collapsed">
|
|
|
|
<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
|
|
|
|
</div>
|
|
|
|
<div class="expanded">
|
|
|
|
<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>
|
|
|
|
|
|
|
|
<!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
|
|
|
|
<div id="manual-nav">
|
|
|
|
<dl>
|
|
|
|
{{if .Consts}}
|
|
|
|
<dd><a href="#pkg-constants">Constants</a></dd>
|
|
|
|
{{end}}
|
|
|
|
{{if .Vars}}
|
|
|
|
<dd><a href="#pkg-variables">Variables</a></dd>
|
|
|
|
{{end}}
|
|
|
|
{{range .Funcs}}
|
|
|
|
{{$name_html := html .Name}}
|
|
|
|
<dd><a href="#{{$name_html}}">{{node_html $ .Decl false}}</a></dd>
|
|
|
|
{{end}}
|
|
|
|
{{range .Types}}
|
|
|
|
{{$tname_html := html .Name}}
|
|
|
|
<dd><a href="#{{$tname_html}}">type {{$tname_html}}</a></dd>
|
|
|
|
{{range .Funcs}}
|
|
|
|
{{$name_html := html .Name}}
|
|
|
|
<dd> <a href="#{{$name_html}}">{{node_html $ .Decl false}}</a></dd>
|
|
|
|
{{end}}
|
|
|
|
{{range .Methods}}
|
|
|
|
{{$name_html := html .Name}}
|
|
|
|
<dd> <a href="#{{$tname_html}}.{{$name_html}}">{{node_html $ .Decl false}}</a></dd>
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{if $.Notes}}
|
|
|
|
{{range $marker, $item := $.Notes}}
|
|
|
|
<dd><a href="#pkg-note-{{$marker}}">{{noteTitle $marker | html}}s</a></dd>
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
</dl>
|
|
|
|
</div><!-- #manual-nav -->
|
|
|
|
|
|
|
|
{{if $.Examples}}
|
|
|
|
<div id="pkg-examples">
|
|
|
|
<h4>Examples</h4>
|
|
|
|
<dl>
|
|
|
|
{{range $.Examples}}
|
|
|
|
<dd><a class="exampleLink" href="#example_{{.Name}}">{{example_name .Name}}</a></dd>
|
|
|
|
{{end}}
|
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{with .Filenames}}
|
|
|
|
<h4>Package files</h4>
|
|
|
|
<p>
|
|
|
|
<span style="font-size:90%">
|
|
|
|
{{range .}}
|
|
|
|
<a href="{{.|srcLink|html}}">{{.|filename|html}}</a>
|
|
|
|
{{end}}
|
|
|
|
</span>
|
|
|
|
</p>
|
|
|
|
{{end}}
|
|
|
|
</div><!-- .expanded -->
|
|
|
|
</div><!-- #pkg-index -->
|
|
|
|
|
|
|
|
{{with .Consts}}
|
|
|
|
<h2 id="pkg-constants">Constants</h2>
|
|
|
|
{{range .}}
|
|
|
|
<pre>{{node_html $ .Decl true}}</pre>
|
|
|
|
{{comment_html .Doc}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{with .Vars}}
|
|
|
|
<h2 id="pkg-variables">Variables</h2>
|
|
|
|
{{range .}}
|
|
|
|
<pre>{{node_html $ .Decl true}}</pre>
|
|
|
|
{{comment_html .Doc}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{range .Funcs}}
|
|
|
|
{{/* Name is a string - no need for FSet */}}
|
|
|
|
{{$name_html := html .Name}}
|
|
|
|
<h2 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a></h2>
|
|
|
|
<pre>{{node_html $ .Decl true}}</pre>
|
|
|
|
{{comment_html .Doc}}
|
|
|
|
{{example_html $ .Name}}
|
|
|
|
{{end}}
|
|
|
|
{{range .Types}}
|
|
|
|
{{$tname := .Name}}
|
|
|
|
{{$tname_html := html .Name}}
|
|
|
|
<h2 id="{{$tname_html}}">type <a href="{{posLink_url $ .Decl}}">{{$tname_html}}</a></h2>
|
|
|
|
<pre>{{node_html $ .Decl true}}</pre>
|
|
|
|
{{comment_html .Doc}}
|
|
|
|
|
|
|
|
{{range .Consts}}
|
|
|
|
<pre>{{node_html $ .Decl true}}</pre>
|
|
|
|
{{comment_html .Doc}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{range .Vars}}
|
|
|
|
<pre>{{node_html $ .Decl true}}</pre>
|
|
|
|
{{comment_html .Doc}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{example_html $ $tname}}
|
|
|
|
|
|
|
|
{{range .Funcs}}
|
|
|
|
{{$name_html := html .Name}}
|
|
|
|
<h3 id="{{$name_html}}">func <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a></h3>
|
|
|
|
<pre>{{node_html $ .Decl true}}</pre>
|
|
|
|
{{comment_html .Doc}}
|
|
|
|
{{example_html $ .Name}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{range .Methods}}
|
|
|
|
{{$name_html := html .Name}}
|
|
|
|
<h3 id="{{$tname_html}}.{{$name_html}}">func ({{html .Recv}}) <a href="{{posLink_url $ .Decl}}">{{$name_html}}</a></h3>
|
|
|
|
<pre>{{node_html $ .Decl true}}</pre>
|
|
|
|
{{comment_html .Doc}}
|
|
|
|
{{$name := printf "%s_%s" $tname .Name}}
|
|
|
|
{{example_html $ $name}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{with $.Notes}}
|
|
|
|
{{range $marker, $content := .}}
|
|
|
|
<h2 id="pkg-note-{{$marker}}">{{noteTitle $marker | html}}s</h2>
|
|
|
|
<ul style="list-style: none; padding: 0;">
|
|
|
|
{{range .}}
|
|
|
|
<li><a href="{{posLink_url $ .}}">☞</a> {{html .Body}}</li>
|
|
|
|
{{end}}
|
|
|
|
</ul>
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{with .PAst}}
|
|
|
|
<pre>{{node_html $ . false}}</pre>
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{with .Dirs}}
|
|
|
|
{{/* DirList entries are numbers and strings - no need for FSet */}}
|
|
|
|
{{if $.PDoc}}
|
|
|
|
<h2 id="pkg-subdirectories">Subdirectories</h2>
|
|
|
|
{{else}}
|
|
|
|
<div class="pkgGopher">
|
|
|
|
<img class="gopher" src="/doc/gopher/pkg.png"/>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
|
|
|
<table class="dir">
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th> </th>
|
|
|
|
<th style="text-align: left; width: auto">Synopsis</th>
|
|
|
|
</tr>
|
|
|
|
{{if not $.DirFlat}}
|
|
|
|
<tr>
|
|
|
|
<td><a href="..">..</a></td>
|
|
|
|
</tr>
|
|
|
|
{{end}}
|
|
|
|
{{range .List}}
|
|
|
|
{{if $.DirFlat}}
|
|
|
|
{{if .HasPkg}}
|
|
|
|
<tr>
|
|
|
|
<td class="name"><a href="{{html .Path}}/">{{html .Path}}</a></td>
|
|
|
|
<td> </td>
|
|
|
|
<td style="width: auto">{{html .Synopsis}}</td>
|
|
|
|
</tr>
|
|
|
|
{{end}}
|
|
|
|
{{else}}
|
|
|
|
<tr>
|
|
|
|
<td class="name">{{repeat ` + "`" + ` ` + "`" + ` .Depth}}<a href="{{html .Path}}/">{{html .Name}}</a></td>
|
|
|
|
<td> </td>
|
|
|
|
<td style="width: auto">{{html .Synopsis}}</td>
|
|
|
|
</tr>
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
</table>
|
|
|
|
{{if $.PDoc}}{{else}}
|
2013-09-15 23:46:38 -06:00
|
|
|
<p>Need more packages? Check out the <a href="/wiki/SubRepositories">sub-repositories</a> and <a href="/wiki/Projects">other Go projects</a>.</p>
|
2013-08-15 19:44:27 -06:00
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
`,
|
|
|
|
"package.txt": `{{with .PAst}}{{node $ .}}{{end}}{{/*
|
|
|
|
|
|
|
|
---------------------------------------
|
|
|
|
|
|
|
|
*/}}{{with .PDoc}}{{if $.IsMain}}COMMAND DOCUMENTATION
|
|
|
|
|
|
|
|
{{comment_text .Doc " " "\t"}}
|
|
|
|
{{else}}PACKAGE DOCUMENTATION
|
|
|
|
|
|
|
|
package {{.Name}}
|
|
|
|
import "{{.ImportPath}}"
|
|
|
|
|
|
|
|
{{comment_text .Doc " " "\t"}}
|
|
|
|
{{example_text $ "" " "}}{{/*
|
|
|
|
|
|
|
|
---------------------------------------
|
|
|
|
|
|
|
|
*/}}{{with .Consts}}
|
|
|
|
CONSTANTS
|
|
|
|
|
|
|
|
{{range .}}{{node $ .Decl}}
|
|
|
|
{{comment_text .Doc " " "\t"}}
|
|
|
|
{{end}}{{end}}{{/*
|
|
|
|
|
|
|
|
---------------------------------------
|
|
|
|
|
|
|
|
*/}}{{with .Vars}}
|
|
|
|
VARIABLES
|
|
|
|
|
|
|
|
{{range .}}{{node $ .Decl}}
|
|
|
|
{{comment_text .Doc " " "\t"}}
|
|
|
|
{{end}}{{end}}{{/*
|
|
|
|
|
|
|
|
---------------------------------------
|
|
|
|
|
|
|
|
*/}}{{with .Funcs}}
|
|
|
|
FUNCTIONS
|
|
|
|
|
|
|
|
{{range .}}{{node $ .Decl}}
|
|
|
|
{{comment_text .Doc " " "\t"}}
|
|
|
|
{{example_text $ .Name " "}}{{end}}{{end}}{{/*
|
|
|
|
|
|
|
|
---------------------------------------
|
|
|
|
|
|
|
|
*/}}{{with .Types}}
|
|
|
|
TYPES
|
|
|
|
|
|
|
|
{{range .}}{{$tname := .Name}}{{node $ .Decl}}
|
|
|
|
{{comment_text .Doc " " "\t"}}
|
|
|
|
{{range .Consts}}{{node $ .Decl}}
|
|
|
|
{{comment_text .Doc " " "\t"}}
|
|
|
|
{{end}}{{range .Vars}}{{node $ .Decl}}
|
|
|
|
{{comment_text .Doc " " "\t"}}
|
|
|
|
{{end}}{{example_text $ .Name " "}}
|
|
|
|
{{range .Funcs}}{{node $ .Decl}}
|
|
|
|
{{comment_text .Doc " " "\t"}}
|
|
|
|
{{example_text $ .Name " "}}
|
|
|
|
{{end}}{{range .Methods}}{{node $ .Decl}}
|
|
|
|
{{comment_text .Doc " " "\t"}}
|
|
|
|
{{$name := printf "%s_%s" $tname .Name}}{{example_text $ $name " "}}{{end}}
|
|
|
|
{{end}}{{end}}{{end}}{{/*
|
|
|
|
|
|
|
|
---------------------------------------
|
|
|
|
|
|
|
|
*/}}{{with $.Notes}}
|
|
|
|
{{range $marker, $content := .}}
|
|
|
|
{{$marker}}S
|
|
|
|
|
|
|
|
{{range $content}}{{comment_text .Body " " "\t"}}
|
|
|
|
{{end}}{{end}}{{end}}{{end}}{{/*
|
|
|
|
|
|
|
|
---------------------------------------
|
|
|
|
|
|
|
|
*/}}{{with .Dirs}}
|
|
|
|
SUBDIRECTORIES
|
|
|
|
{{if $.DirFlat}}{{range .List}}{{if .HasPkg}}
|
|
|
|
{{.Path}}{{end}}{{end}}
|
|
|
|
{{else}}{{range .List}}
|
|
|
|
{{repeat ` + "`" + `. ` + "`" + ` .Depth}}{{.Name}}{{end}}
|
|
|
|
{{end}}{{end}}
|
2013-09-17 23:12:51 -06:00
|
|
|
`,
|
|
|
|
"play.js": `// Copyright 2012 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.
|
|
|
|
|
|
|
|
function initPlayground(transport) {
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
function text(node) {
|
|
|
|
var s = "";
|
|
|
|
for (var i = 0; i < node.childNodes.length; i++) {
|
|
|
|
var n = node.childNodes[i];
|
2013-09-30 19:20:35 -06:00
|
|
|
if (n.nodeType === 1) {
|
|
|
|
if (n.tagName === "BUTTON") continue
|
|
|
|
if (n.tagName === "SPAN" && n.className === "number") continue;
|
|
|
|
if (n.tagName === "DIV" || n.tagName == "BR") {
|
|
|
|
s += "\n";
|
|
|
|
}
|
2013-09-17 23:12:51 -06:00
|
|
|
s += text(n);
|
2013-09-30 18:43:07 -06:00
|
|
|
continue;
|
2013-09-17 23:12:51 -06:00
|
|
|
}
|
2013-09-30 19:20:35 -06:00
|
|
|
if (n.nodeType === 3) {
|
|
|
|
s += n.nodeValue;
|
|
|
|
}
|
2013-09-17 23:12:51 -06:00
|
|
|
}
|
2013-09-30 19:20:35 -06:00
|
|
|
return s.replace("\xA0", " "); // replace non-breaking spaces
|
2013-09-17 23:12:51 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
function init(code) {
|
|
|
|
var output = document.createElement('div');
|
|
|
|
var outpre = document.createElement('pre');
|
|
|
|
var running;
|
|
|
|
|
|
|
|
if ($ && $(output).resizable) {
|
|
|
|
$(output).resizable({
|
|
|
|
handles: "n,w,nw",
|
|
|
|
minHeight: 27,
|
|
|
|
minWidth: 135,
|
|
|
|
maxHeight: 608,
|
|
|
|
maxWidth: 990
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function onKill() {
|
|
|
|
if (running) running.Kill();
|
|
|
|
}
|
|
|
|
|
|
|
|
function onRun(e) {
|
|
|
|
onKill();
|
|
|
|
output.style.display = "block";
|
|
|
|
outpre.innerHTML = "";
|
|
|
|
run1.style.display = "none";
|
|
|
|
var options = {Race: e.shiftKey};
|
|
|
|
running = transport.Run(text(code), PlaygroundOutput(outpre), options);
|
|
|
|
}
|
|
|
|
|
|
|
|
function onClose() {
|
|
|
|
onKill();
|
|
|
|
output.style.display = "none";
|
|
|
|
run1.style.display = "inline-block";
|
|
|
|
}
|
|
|
|
|
|
|
|
var run1 = document.createElement('button');
|
|
|
|
run1.innerHTML = 'Run';
|
|
|
|
run1.className = 'run';
|
|
|
|
run1.addEventListener("click", onRun, false);
|
|
|
|
var run2 = document.createElement('button');
|
|
|
|
run2.className = 'run';
|
|
|
|
run2.innerHTML = 'Run';
|
|
|
|
run2.addEventListener("click", onRun, false);
|
|
|
|
var kill = document.createElement('button');
|
|
|
|
kill.className = 'kill';
|
|
|
|
kill.innerHTML = 'Kill';
|
|
|
|
kill.addEventListener("click", onKill, false);
|
|
|
|
var close = document.createElement('button');
|
|
|
|
close.className = 'close';
|
|
|
|
close.innerHTML = 'Close';
|
|
|
|
close.addEventListener("click", onClose, false);
|
|
|
|
|
|
|
|
var button = document.createElement('div');
|
|
|
|
button.classList.add('buttons');
|
|
|
|
button.appendChild(run1);
|
|
|
|
// Hack to simulate insertAfter
|
|
|
|
code.parentNode.insertBefore(button, code.nextSibling);
|
|
|
|
|
|
|
|
var buttons = document.createElement('div');
|
|
|
|
buttons.classList.add('buttons');
|
|
|
|
buttons.appendChild(run2);
|
|
|
|
buttons.appendChild(kill);
|
|
|
|
buttons.appendChild(close);
|
|
|
|
|
|
|
|
output.classList.add('output');
|
|
|
|
output.appendChild(buttons);
|
|
|
|
output.appendChild(outpre);
|
|
|
|
output.style.display = "none";
|
|
|
|
code.parentNode.insertBefore(output, button.nextSibling);
|
|
|
|
}
|
|
|
|
|
|
|
|
var play = document.querySelectorAll('div.playground');
|
|
|
|
for (var i = 0; i < play.length; i++) {
|
|
|
|
init(play[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-15 19:44:27 -06:00
|
|
|
`,
|
|
|
|
"playground.js": `// Copyright 2012 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.
|
|
|
|
|
|
|
|
/*
|
|
|
|
In the absence of any formal way to specify interfaces in JavaScript,
|
|
|
|
here's a skeleton implementation of a playground transport.
|
|
|
|
|
|
|
|
function Transport() {
|
|
|
|
// Set up any transport state (eg, make a websocket connnection).
|
|
|
|
return {
|
|
|
|
Run: function(body, output, options) {
|
|
|
|
// Compile and run the program 'body' with 'options'.
|
|
|
|
// Call the 'output' callback to display program output.
|
|
|
|
return {
|
|
|
|
Kill: function() {
|
|
|
|
// Kill the running program.
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
// The output callback is called multiple times, and each time it is
|
|
|
|
// passed an object of this form.
|
|
|
|
var write = {
|
|
|
|
Kind: 'string', // 'start', 'stdout', 'stderr', 'end'
|
|
|
|
Body: 'string' // content of write or end status message
|
|
|
|
}
|
|
|
|
|
|
|
|
// The first call must be of Kind 'start' with no body.
|
|
|
|
// Subsequent calls may be of Kind 'stdout' or 'stderr'
|
|
|
|
// and must have a non-null Body string.
|
|
|
|
// The final call should be of Kind 'end' with an optional
|
|
|
|
// Body string, signifying a failure ("killed", for example).
|
|
|
|
|
|
|
|
// The output callback must be of this form.
|
|
|
|
// See PlaygroundOutput (below) for an implementation.
|
|
|
|
function outputCallback(write) {
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
function HTTPTransport() {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// TODO(adg): support stderr
|
|
|
|
|
|
|
|
function playback(output, events) {
|
|
|
|
var timeout;
|
|
|
|
output({Kind: 'start'});
|
|
|
|
function next() {
|
|
|
|
if (events.length === 0) {
|
|
|
|
output({Kind: 'end'});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var e = events.shift();
|
|
|
|
if (e.Delay === 0) {
|
|
|
|
output({Kind: 'stdout', Body: e.Message});
|
|
|
|
next();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
timeout = setTimeout(function() {
|
|
|
|
output({Kind: 'stdout', Body: e.Message});
|
|
|
|
next();
|
|
|
|
}, e.Delay / 1000000);
|
|
|
|
}
|
|
|
|
next();
|
|
|
|
return {
|
|
|
|
Stop: function() {
|
|
|
|
clearTimeout(timeout);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function error(output, msg) {
|
|
|
|
output({Kind: 'start'});
|
|
|
|
output({Kind: 'stderr', Body: msg});
|
|
|
|
output({Kind: 'end'});
|
|
|
|
}
|
|
|
|
|
|
|
|
var seq = 0;
|
|
|
|
return {
|
|
|
|
Run: function(body, output, options) {
|
|
|
|
seq++;
|
|
|
|
var cur = seq;
|
|
|
|
var playing;
|
|
|
|
$.ajax('/compile', {
|
|
|
|
type: 'POST',
|
|
|
|
data: {'version': 2, 'body': body},
|
|
|
|
dataType: 'json',
|
|
|
|
success: function(data) {
|
|
|
|
if (seq != cur) return;
|
|
|
|
if (!data) return;
|
|
|
|
if (playing != null) playing.Stop();
|
|
|
|
if (data.Errors) {
|
|
|
|
error(output, data.Errors);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
playing = playback(output, data.Events);
|
|
|
|
},
|
|
|
|
error: function() {
|
|
|
|
error(output, 'Error communicating with remote server.');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return {
|
|
|
|
Kill: function() {
|
|
|
|
if (playing != null) playing.Stop();
|
|
|
|
output({Kind: 'end', Body: 'killed'});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function SocketTransport() {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var id = 0;
|
|
|
|
var outputs = {};
|
|
|
|
var started = {};
|
|
|
|
var websocket = new WebSocket('ws://' + window.location.host + '/socket');
|
|
|
|
|
|
|
|
websocket.onclose = function() {
|
|
|
|
console.log('websocket connection closed');
|
|
|
|
}
|
|
|
|
|
|
|
|
websocket.onmessage = function(e) {
|
|
|
|
var m = JSON.parse(e.data);
|
|
|
|
var output = outputs[m.Id];
|
|
|
|
if (output === null)
|
|
|
|
return;
|
|
|
|
if (!started[m.Id]) {
|
|
|
|
output({Kind: 'start'});
|
|
|
|
started[m.Id] = true;
|
|
|
|
}
|
|
|
|
output({Kind: m.Kind, Body: m.Body});
|
|
|
|
}
|
|
|
|
|
|
|
|
function send(m) {
|
|
|
|
websocket.send(JSON.stringify(m));
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
Run: function(body, output, options) {
|
|
|
|
var thisID = id+'';
|
|
|
|
id++;
|
|
|
|
outputs[thisID] = output;
|
|
|
|
send({Id: thisID, Kind: 'run', Body: body, Options: options});
|
|
|
|
return {
|
|
|
|
Kill: function() {
|
|
|
|
send({Id: thisID, Kind: 'kill'});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function PlaygroundOutput(el) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
return function(write) {
|
|
|
|
if (write.Kind == 'start') {
|
|
|
|
el.innerHTML = '';
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var cl = 'system';
|
|
|
|
if (write.Kind == 'stdout' || write.Kind == 'stderr')
|
|
|
|
cl = write.Kind;
|
|
|
|
|
|
|
|
var m = write.Body;
|
|
|
|
if (write.Kind == 'end')
|
|
|
|
m = '\nProgram exited' + (m?(': '+m):'.');
|
|
|
|
|
|
|
|
if (m.indexOf('IMAGE:') === 0) {
|
|
|
|
// TODO(adg): buffer all writes before creating image
|
|
|
|
var url = 'data:image/png;base64,' + m.substr(6);
|
|
|
|
var img = document.createElement('img');
|
|
|
|
img.src = url;
|
|
|
|
el.appendChild(img);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ^L clears the screen.
|
|
|
|
var s = m.split('\x0c');
|
|
|
|
if (s.length > 1) {
|
|
|
|
el.innerHTML = '';
|
|
|
|
m = s.pop();
|
|
|
|
}
|
|
|
|
|
|
|
|
m = m.replace(/&/g, '&');
|
|
|
|
m = m.replace(/</g, '<');
|
|
|
|
m = m.replace(/>/g, '>');
|
|
|
|
|
|
|
|
var needScroll = (el.scrollTop + el.offsetHeight) == el.scrollHeight;
|
|
|
|
|
|
|
|
var span = document.createElement('span');
|
|
|
|
span.className = cl;
|
|
|
|
span.innerHTML = m;
|
|
|
|
el.appendChild(span);
|
|
|
|
|
|
|
|
if (needScroll)
|
|
|
|
el.scrollTop = el.scrollHeight - el.offsetHeight;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
function lineHighlight(error) {
|
|
|
|
var regex = /prog.go:([0-9]+)/g;
|
|
|
|
var r = regex.exec(error);
|
|
|
|
while (r) {
|
|
|
|
$(".lines div").eq(r[1]-1).addClass("lineerror");
|
|
|
|
r = regex.exec(error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function highlightOutput(wrappedOutput) {
|
|
|
|
return function(write) {
|
|
|
|
if (write.Body) lineHighlight(write.Body);
|
|
|
|
wrappedOutput(write);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function lineClear() {
|
|
|
|
$(".lineerror").removeClass("lineerror");
|
|
|
|
}
|
|
|
|
|
|
|
|
// opts is an object with these keys
|
|
|
|
// codeEl - code editor element
|
|
|
|
// outputEl - program output element
|
|
|
|
// runEl - run button element
|
|
|
|
// fmtEl - fmt button element (optional)
|
|
|
|
// shareEl - share button element (optional)
|
|
|
|
// shareURLEl - share URL text input element (optional)
|
|
|
|
// shareRedirect - base URL to redirect to on share (optional)
|
|
|
|
// toysEl - toys select element (optional)
|
|
|
|
// enableHistory - enable using HTML5 history API (optional)
|
|
|
|
// transport - playground transport to use (default is HTTPTransport)
|
|
|
|
function playground(opts) {
|
|
|
|
var code = $(opts.codeEl);
|
|
|
|
var transport = opts['transport'] || new HTTPTransport();
|
|
|
|
var running;
|
|
|
|
|
|
|
|
// autoindent helpers.
|
|
|
|
function insertTabs(n) {
|
|
|
|
// find the selection start and end
|
|
|
|
var start = code[0].selectionStart;
|
|
|
|
var end = code[0].selectionEnd;
|
|
|
|
// split the textarea content into two, and insert n tabs
|
|
|
|
var v = code[0].value;
|
|
|
|
var u = v.substr(0, start);
|
|
|
|
for (var i=0; i<n; i++) {
|
|
|
|
u += "\t";
|
|
|
|
}
|
|
|
|
u += v.substr(end);
|
|
|
|
// set revised content
|
|
|
|
code[0].value = u;
|
|
|
|
// reset caret position after inserted tabs
|
|
|
|
code[0].selectionStart = start+n;
|
|
|
|
code[0].selectionEnd = start+n;
|
|
|
|
}
|
|
|
|
function autoindent(el) {
|
|
|
|
var curpos = el.selectionStart;
|
|
|
|
var tabs = 0;
|
|
|
|
while (curpos > 0) {
|
|
|
|
curpos--;
|
|
|
|
if (el.value[curpos] == "\t") {
|
|
|
|
tabs++;
|
|
|
|
} else if (tabs > 0 || el.value[curpos] == "\n") {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setTimeout(function() {
|
|
|
|
insertTabs(tabs);
|
|
|
|
}, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
function keyHandler(e) {
|
|
|
|
if (e.keyCode == 9) { // tab
|
|
|
|
insertTabs(1);
|
|
|
|
e.preventDefault();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (e.keyCode == 13) { // enter
|
|
|
|
if (e.shiftKey) { // +shift
|
|
|
|
run();
|
|
|
|
e.preventDefault();
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
autoindent(e.target);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
code.unbind('keydown').bind('keydown', keyHandler);
|
|
|
|
var outdiv = $(opts.outputEl).empty();
|
|
|
|
var output = $('<pre/>').appendTo(outdiv);
|
|
|
|
|
|
|
|
function body() {
|
|
|
|
return $(opts.codeEl).val();
|
|
|
|
}
|
|
|
|
function setBody(text) {
|
|
|
|
$(opts.codeEl).val(text);
|
|
|
|
}
|
|
|
|
function origin(href) {
|
|
|
|
return (""+href).split("/").slice(0, 3).join("/");
|
|
|
|
}
|
|
|
|
|
|
|
|
var pushedEmpty = (window.location.pathname == "/");
|
|
|
|
function inputChanged() {
|
|
|
|
if (pushedEmpty) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
pushedEmpty = true;
|
|
|
|
$(opts.shareURLEl).hide();
|
|
|
|
window.history.pushState(null, "", "/");
|
|
|
|
}
|
|
|
|
function popState(e) {
|
|
|
|
if (e === null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (e && e.state && e.state.code) {
|
|
|
|
setBody(e.state.code);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var rewriteHistory = false;
|
|
|
|
if (window.history && window.history.pushState && window.addEventListener && opts.enableHistory) {
|
|
|
|
rewriteHistory = true;
|
|
|
|
code[0].addEventListener('input', inputChanged);
|
|
|
|
window.addEventListener('popstate', popState);
|
|
|
|
}
|
|
|
|
|
|
|
|
function setError(error) {
|
|
|
|
if (running) running.Kill();
|
|
|
|
lineClear();
|
|
|
|
lineHighlight(error);
|
|
|
|
output.empty().addClass("error").text(error);
|
|
|
|
}
|
|
|
|
function loading() {
|
|
|
|
lineClear();
|
|
|
|
if (running) running.Kill();
|
|
|
|
output.removeClass("error").text('Waiting for remote server...');
|
|
|
|
}
|
|
|
|
function run() {
|
|
|
|
loading();
|
|
|
|
running = transport.Run(body(), highlightOutput(PlaygroundOutput(output[0])));
|
|
|
|
}
|
|
|
|
function fmt() {
|
|
|
|
loading();
|
|
|
|
$.ajax("/fmt", {
|
|
|
|
data: {"body": body()},
|
|
|
|
type: "POST",
|
|
|
|
dataType: "json",
|
|
|
|
success: function(data) {
|
|
|
|
if (data.Error) {
|
|
|
|
setError(data.Error);
|
|
|
|
} else {
|
|
|
|
setBody(data.Body);
|
|
|
|
setError("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$(opts.runEl).click(run);
|
|
|
|
$(opts.fmtEl).click(fmt);
|
|
|
|
|
|
|
|
if (opts.shareEl !== null && (opts.shareURLEl !== null || opts.shareRedirect !== null)) {
|
|
|
|
var shareURL;
|
|
|
|
if (opts.shareURLEl) {
|
|
|
|
shareURL = $(opts.shareURLEl).hide();
|
|
|
|
}
|
|
|
|
var sharing = false;
|
|
|
|
$(opts.shareEl).click(function() {
|
|
|
|
if (sharing) return;
|
|
|
|
sharing = true;
|
|
|
|
var sharingData = body();
|
|
|
|
$.ajax("/share", {
|
|
|
|
processData: false,
|
|
|
|
data: sharingData,
|
|
|
|
type: "POST",
|
|
|
|
complete: function(xhr) {
|
|
|
|
sharing = false;
|
|
|
|
if (xhr.status != 200) {
|
|
|
|
alert("Server error; try again.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (opts.shareRedirect) {
|
|
|
|
window.location = opts.shareRedirect + xhr.responseText;
|
|
|
|
}
|
|
|
|
if (shareURL) {
|
|
|
|
var path = "/p/" + xhr.responseText;
|
|
|
|
var url = origin(window.location) + path;
|
|
|
|
shareURL.show().val(url).focus().select();
|
|
|
|
|
|
|
|
if (rewriteHistory) {
|
|
|
|
var historyData = {"code": sharingData};
|
|
|
|
window.history.pushState(historyData, "", path);
|
|
|
|
pushedEmpty = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (opts.toysEl !== null) {
|
|
|
|
$(opts.toysEl).bind('change', function() {
|
|
|
|
var toy = $(this).val();
|
|
|
|
$.ajax("/doc/play/"+toy, {
|
|
|
|
processData: false,
|
|
|
|
type: "GET",
|
|
|
|
complete: function(xhr) {
|
|
|
|
if (xhr.status != 200) {
|
|
|
|
alert("Server error; try again.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
setBody(xhr.responseText);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
window.playground = playground;
|
|
|
|
})();
|
|
|
|
`,
|
|
|
|
"search.html": `<!--
|
|
|
|
Copyright 2009 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.
|
|
|
|
-->
|
|
|
|
{{$query_url := urlquery .Query}}
|
|
|
|
{{with .Alert}}
|
|
|
|
<p>
|
|
|
|
<span class="alert" style="font-size:120%">{{html .}}</span>
|
|
|
|
</p>
|
|
|
|
{{end}}
|
|
|
|
{{with .Alt}}
|
|
|
|
<p>
|
|
|
|
<span class="alert" style="font-size:120%">Did you mean: </span>
|
|
|
|
{{range .Alts}}
|
|
|
|
<a href="search?q={{urlquery .}}" style="font-size:120%">{{html .}}</a>
|
|
|
|
{{end}}
|
|
|
|
</p>
|
|
|
|
{{end}}
|
|
|
|
{{with .Pak}}
|
|
|
|
<h2 id="Packages">Package {{html $.Query}}</h2>
|
|
|
|
<p>
|
|
|
|
<table class="layout">
|
|
|
|
{{range .}}
|
|
|
|
{{$pkg_html := pkgLink .Pak.Path | html}}
|
|
|
|
<tr><td><a href="/{{$pkg_html}}">{{$pkg_html}}</a></td></tr>
|
|
|
|
{{end}}
|
|
|
|
</table>
|
|
|
|
</p>
|
|
|
|
{{end}}
|
2013-11-21 09:55:42 -07:00
|
|
|
{{range $key, $val := .Idents}}
|
|
|
|
{{if $val}}
|
|
|
|
<h2 id="Global">{{$key.Name}}</h2>
|
|
|
|
{{range $val}}
|
|
|
|
{{$pkg_html := pkgLink .Path | html}}
|
|
|
|
{{$doc_html := docLink .Path .Name| html}}
|
|
|
|
<a href="/{{$pkg_html}}">{{html .Package}}</a>.<a href="{{$doc_html}}">{{.Name}}</a>
|
|
|
|
{{if .Doc}}
|
|
|
|
<p>{{comment_html .Doc}}</p>
|
|
|
|
{{else}}
|
|
|
|
<p><em>No documentation available</em></p>
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
2013-08-15 19:44:27 -06:00
|
|
|
{{with .Hit}}
|
|
|
|
{{with .Decls}}
|
|
|
|
<h2 id="Global">Package-level declarations</h2>
|
|
|
|
{{range .}}
|
|
|
|
{{$pkg_html := pkgLink .Pak.Path | html}}
|
|
|
|
<h3 id="Global_{{$pkg_html}}">package <a href="/{{$pkg_html}}">{{html .Pak.Name}}</a></h3>
|
|
|
|
{{range .Files}}
|
2013-12-04 08:37:01 -07:00
|
|
|
{{$file := .File.Path}}
|
2013-08-15 19:44:27 -06:00
|
|
|
{{range .Groups}}
|
|
|
|
{{range .}}
|
2013-12-04 08:37:01 -07:00
|
|
|
{{$line := infoLine .}}
|
|
|
|
<a href="{{queryLink $file $query_url $line | html}}">{{$file}}:{{$line}}</a>
|
2013-08-15 19:44:27 -06:00
|
|
|
{{infoSnippet_html .}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{with .Others}}
|
|
|
|
<h2 id="Local">Local declarations and uses</h2>
|
|
|
|
{{range .}}
|
|
|
|
{{$pkg_html := pkgLink .Pak.Path | html}}
|
|
|
|
<h3 id="Local_{{$pkg_html}}">package <a href="/{{$pkg_html}}">{{html .Pak.Name}}</a></h3>
|
|
|
|
{{range .Files}}
|
2013-12-04 08:37:01 -07:00
|
|
|
{{$file := .File.Path}}
|
|
|
|
<a href="{{queryLink $file $query_url 0 | html}}">{{$file}}</a>
|
2013-08-15 19:44:27 -06:00
|
|
|
<table class="layout">
|
|
|
|
{{range .Groups}}
|
|
|
|
<tr>
|
|
|
|
<td width="25"></td>
|
|
|
|
<th align="left" valign="top">{{index . 0 | infoKind_html}}</th>
|
|
|
|
<td align="left" width="4"></td>
|
|
|
|
<td>
|
|
|
|
{{range .}}
|
2013-12-04 08:37:01 -07:00
|
|
|
{{$line := infoLine .}}
|
|
|
|
<a href="{{queryLink $file $query_url $line | html}}">{{$line}}</a>
|
2013-08-15 19:44:27 -06:00
|
|
|
{{end}}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{{end}}
|
|
|
|
</table>
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
{{with .Textual}}
|
|
|
|
{{if $.Complete}}
|
|
|
|
<h2 id="Textual">{{html $.Found}} textual occurrences</h2>
|
|
|
|
{{else}}
|
|
|
|
<h2 id="Textual">More than {{html $.Found}} textual occurrences</h2>
|
|
|
|
<p>
|
|
|
|
<span class="alert" style="font-size:120%">Not all files or lines containing "{{html $.Query}}" are shown.</span>
|
|
|
|
</p>
|
|
|
|
{{end}}
|
|
|
|
<p>
|
|
|
|
<table class="layout">
|
|
|
|
{{range .}}
|
2013-12-04 08:37:01 -07:00
|
|
|
{{$file := .Filename}}
|
2013-08-15 19:44:27 -06:00
|
|
|
<tr>
|
|
|
|
<td align="left" valign="top">
|
2013-12-04 08:37:01 -07:00
|
|
|
<a href="{{queryLink $file $query_url 0}}">{{$file}}</a>:
|
2013-08-15 19:44:27 -06:00
|
|
|
</td>
|
|
|
|
<td align="left" width="4"></td>
|
|
|
|
<th align="left" valign="top">{{len .Lines}}</th>
|
|
|
|
<td align="left" width="4"></td>
|
|
|
|
<td align="left">
|
|
|
|
{{range .Lines}}
|
2013-12-04 08:37:01 -07:00
|
|
|
<a href="{{queryLink $file $query_url .}}">{{html .}}</a>
|
2013-08-15 19:44:27 -06:00
|
|
|
{{end}}
|
|
|
|
{{if not $.Complete}}
|
|
|
|
...
|
|
|
|
{{end}}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{{end}}
|
|
|
|
{{if not $.Complete}}
|
|
|
|
<tr><td align="left">...</td></tr>
|
|
|
|
{{end}}
|
|
|
|
</table>
|
|
|
|
</p>
|
|
|
|
{{end}}
|
|
|
|
`,
|
|
|
|
"search.txt": `QUERY
|
|
|
|
{{.Query}}
|
|
|
|
|
|
|
|
{{with .Alert}}{{.}}
|
|
|
|
{{end}}{{/* .Alert */}}{{/*
|
|
|
|
|
|
|
|
---------------------------------------
|
|
|
|
|
|
|
|
*/}}{{with .Alt}}DID YOU MEAN
|
|
|
|
|
|
|
|
{{range .Alts}} {{.}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}{{/* .Alt */}}{{/*
|
|
|
|
|
|
|
|
---------------------------------------
|
|
|
|
|
|
|
|
*/}}{{with .Pak}}PACKAGE {{$.Query}}
|
|
|
|
|
|
|
|
{{range .}} {{pkgLink .Pak.Path}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}{{/* .Pak */}}{{/*
|
|
|
|
|
|
|
|
---------------------------------------
|
|
|
|
|
2013-11-21 09:55:42 -07:00
|
|
|
*/}}{{range $key, $val := .Idents}}{{if $val}}{{$key.Name}}
|
|
|
|
{{range $val.Idents}} {{.Path}}.{{.Name}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}{{end}}{{/* .Idents */}}{{/*
|
|
|
|
|
|
|
|
---------------------------------------
|
|
|
|
|
2013-08-15 19:44:27 -06:00
|
|
|
*/}}{{with .Hit}}{{with .Decls}}PACKAGE-LEVEL DECLARATIONS
|
|
|
|
|
|
|
|
{{range .}}package {{.Pak.Name}}
|
|
|
|
{{range $file := .Files}}{{range .Groups}}{{range .}} {{srcLink $file.File.Path}}:{{infoLine .}}{{end}}
|
|
|
|
{{end}}{{end}}{{/* .Files */}}
|
|
|
|
{{end}}{{end}}{{/* .Decls */}}{{/*
|
|
|
|
|
|
|
|
---------------------------------------
|
|
|
|
|
|
|
|
*/}}{{with .Others}}LOCAL DECLARATIONS AND USES
|
|
|
|
|
|
|
|
{{range .}}package {{.Pak.Name}}
|
|
|
|
{{range $file := .Files}}{{range .Groups}}{{range .}} {{srcLink $file.File.Path}}:{{infoLine .}}
|
|
|
|
{{end}}{{end}}{{end}}{{/* .Files */}}
|
|
|
|
{{end}}{{end}}{{/* .Others */}}{{end}}{{/* .Hit */}}{{/*
|
|
|
|
|
|
|
|
---------------------------------------
|
|
|
|
|
|
|
|
*/}}{{if .Textual}}{{if .Complete}}{{.Found}} TEXTUAL OCCURRENCES{{else}}MORE THAN {{.Found}} TEXTUAL OCCURRENCES{{end}}
|
|
|
|
|
|
|
|
{{range .Textual}}{{len .Lines}} {{srcLink .Filename}}
|
|
|
|
{{end}}{{if not .Complete}}... ...
|
|
|
|
{{end}}{{end}}
|
|
|
|
`,
|
|
|
|
"style.css": `body {
|
|
|
|
margin: 0;
|
|
|
|
font-family: Helvetica, Arial, sans-serif;
|
|
|
|
font-size: 16px;
|
|
|
|
}
|
|
|
|
pre,
|
|
|
|
code {
|
|
|
|
font-family: Menlo, monospace;
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
|
|
|
pre {
|
|
|
|
line-height: 18px;
|
|
|
|
}
|
|
|
|
pre .comment {
|
|
|
|
color: #006600;
|
|
|
|
}
|
|
|
|
pre .highlight,
|
|
|
|
pre .highlight-comment,
|
|
|
|
pre .selection-highlight,
|
|
|
|
pre .selection-highlight-comment {
|
|
|
|
background: #FFFF00;
|
|
|
|
}
|
|
|
|
pre .selection,
|
|
|
|
pre .selection-comment {
|
|
|
|
background: #FF9632;
|
|
|
|
}
|
|
|
|
pre .ln {
|
|
|
|
color: #999;
|
|
|
|
}
|
|
|
|
body {
|
|
|
|
color: #222;
|
|
|
|
}
|
|
|
|
a,
|
|
|
|
.exampleHeading .text {
|
|
|
|
color: #375EAB;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
a:hover,
|
|
|
|
.exampleHeading .text:hover {
|
|
|
|
text-decoration: underline;
|
|
|
|
}
|
|
|
|
p,
|
|
|
|
pre,
|
|
|
|
ul,
|
|
|
|
ol {
|
|
|
|
margin: 20px;
|
|
|
|
}
|
|
|
|
pre {
|
|
|
|
background: #e9e9e9;
|
|
|
|
padding: 10px;
|
|
|
|
|
|
|
|
-webkit-border-radius: 5px;
|
|
|
|
-moz-border-radius: 5px;
|
|
|
|
border-radius: 5px;
|
|
|
|
}
|
|
|
|
|
|
|
|
h1,
|
|
|
|
h2,
|
|
|
|
h3,
|
|
|
|
h4,
|
|
|
|
.rootHeading {
|
|
|
|
margin: 20px 0;
|
|
|
|
padding: 0;
|
|
|
|
color: #375EAB;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
h1 {
|
|
|
|
font-size: 24px;
|
|
|
|
}
|
|
|
|
h2 {
|
|
|
|
font-size: 20px;
|
|
|
|
background: #E0EBF5;
|
|
|
|
padding: 2px 5px;
|
|
|
|
}
|
|
|
|
h3 {
|
|
|
|
font-size: 20px;
|
|
|
|
}
|
|
|
|
h3,
|
|
|
|
h4 {
|
|
|
|
margin: 20px 5px;
|
|
|
|
}
|
|
|
|
h4 {
|
|
|
|
font-size: 16px;
|
|
|
|
}
|
|
|
|
.rootHeading {
|
|
|
|
font-size: 20px;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
dl {
|
|
|
|
margin: 20px;
|
|
|
|
}
|
|
|
|
dd {
|
|
|
|
margin: 2px 20px;
|
|
|
|
}
|
|
|
|
dl,
|
|
|
|
dd {
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
|
|
|
div#nav table td {
|
|
|
|
vertical-align: top;
|
|
|
|
}
|
|
|
|
|
|
|
|
table.dir th {
|
|
|
|
text-align: left;
|
|
|
|
}
|
|
|
|
table.dir td {
|
|
|
|
word-wrap: break-word;
|
|
|
|
vertical-align: top;
|
|
|
|
}
|
|
|
|
div#page.wide table.dir td.name {
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
|
|
|
.alert {
|
|
|
|
color: #AA0000;
|
|
|
|
}
|
|
|
|
|
|
|
|
div#heading {
|
|
|
|
float: left;
|
|
|
|
margin: 0 0 10px 0;
|
|
|
|
padding: 21px 0;
|
|
|
|
font-size: 20px;
|
|
|
|
font-weight: normal;
|
|
|
|
}
|
|
|
|
div#heading a {
|
|
|
|
color: #222;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
div#topbar {
|
|
|
|
background: #E0EBF5;
|
|
|
|
height: 64px;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
body {
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
div#page {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
div#page > .container,
|
|
|
|
div#topbar > .container {
|
|
|
|
text-align: left;
|
|
|
|
margin-left: auto;
|
|
|
|
margin-right: auto;
|
|
|
|
padding: 0 20px;
|
|
|
|
width: 900px;
|
|
|
|
}
|
|
|
|
div#page.wide > .container,
|
|
|
|
div#topbar.wide > .container {
|
|
|
|
width: auto;
|
|
|
|
}
|
|
|
|
div#plusone {
|
|
|
|
float: right;
|
|
|
|
clear: right;
|
|
|
|
margin-top: 5px;
|
|
|
|
}
|
|
|
|
|
|
|
|
div#footer {
|
|
|
|
text-align: center;
|
|
|
|
color: #666;
|
|
|
|
font-size: 14px;
|
|
|
|
margin: 40px 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
div#menu > a,
|
|
|
|
div#menu > input,
|
|
|
|
div#learn .buttons a,
|
|
|
|
div.play .buttons a,
|
|
|
|
div#blog .read a {
|
|
|
|
padding: 10px;
|
|
|
|
|
|
|
|
text-decoration: none;
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
|
|
-webkit-border-radius: 5px;
|
|
|
|
-moz-border-radius: 5px;
|
|
|
|
border-radius: 5px;
|
|
|
|
}
|
|
|
|
div#playground .buttons a,
|
|
|
|
div#menu > a,
|
|
|
|
div#menu > input {
|
|
|
|
border: 1px solid #375EAB;
|
|
|
|
}
|
|
|
|
div#playground .buttons a,
|
|
|
|
div#menu > a {
|
|
|
|
color: white;
|
|
|
|
background: #375EAB;
|
|
|
|
}
|
|
|
|
#playgroundButton.active {
|
|
|
|
background: white;
|
|
|
|
color: #375EAB;
|
|
|
|
}
|
|
|
|
a#start,
|
|
|
|
div#learn .buttons a,
|
|
|
|
div.play .buttons a,
|
|
|
|
div#blog .read a {
|
|
|
|
color: #222;
|
|
|
|
border: 1px solid #375EAB;
|
|
|
|
background: #E0EBF5;
|
|
|
|
}
|
|
|
|
.download {
|
|
|
|
width: 150px;
|
|
|
|
}
|
|
|
|
|
|
|
|
div#menu {
|
|
|
|
float: right;
|
|
|
|
min-width: 590px;
|
|
|
|
padding: 10px 0;
|
|
|
|
text-align: right;
|
|
|
|
}
|
|
|
|
div#menu > a {
|
|
|
|
margin-right: 5px;
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
|
|
padding: 10px;
|
|
|
|
}
|
|
|
|
div#menu > input {
|
|
|
|
position: relative;
|
|
|
|
top: 1px;
|
|
|
|
width: 60px;
|
|
|
|
background: white;
|
|
|
|
color: #222;
|
|
|
|
}
|
|
|
|
div#menu > input.inactive {
|
|
|
|
color: #999;
|
|
|
|
}
|
|
|
|
|
|
|
|
div.left {
|
|
|
|
float: left;
|
|
|
|
clear: left;
|
|
|
|
}
|
|
|
|
div.right {
|
|
|
|
float: right;
|
|
|
|
clear: right;
|
|
|
|
}
|
|
|
|
div.left,
|
|
|
|
div.right {
|
|
|
|
width: 415px;
|
|
|
|
}
|
|
|
|
|
|
|
|
div#learn,
|
|
|
|
div#about {
|
|
|
|
padding-top: 20px;
|
|
|
|
}
|
|
|
|
div#learn h2,
|
|
|
|
div#about {
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
div#about {
|
|
|
|
font-size: 20px;
|
|
|
|
}
|
|
|
|
|
|
|
|
div#about {
|
|
|
|
height: 96px;
|
|
|
|
}
|
|
|
|
div#gopher {
|
|
|
|
background: url(/doc/gopher/frontpage.png) no-repeat;
|
|
|
|
background-position: center top;
|
|
|
|
height: 155px;
|
|
|
|
}
|
|
|
|
a#start {
|
|
|
|
display: block;
|
|
|
|
padding: 10px;
|
|
|
|
|
|
|
|
text-align: center;
|
|
|
|
text-decoration: none;
|
|
|
|
|
|
|
|
-webkit-border-radius: 5px;
|
|
|
|
-moz-border-radius: 5px;
|
|
|
|
border-radius: 5px;
|
|
|
|
}
|
|
|
|
a#start .big {
|
|
|
|
display: block;
|
|
|
|
font-weight: bold;
|
|
|
|
font-size: 20px;
|
|
|
|
}
|
|
|
|
a#start .desc {
|
|
|
|
display: block;
|
|
|
|
font-size: 14px;
|
|
|
|
font-weight: normal;
|
|
|
|
margin-top: 5px;
|
|
|
|
}
|
|
|
|
|
2013-09-15 23:46:38 -06:00
|
|
|
div#learn .popout {
|
2013-08-15 19:44:27 -06:00
|
|
|
float: right;
|
2013-09-15 23:46:38 -06:00
|
|
|
display: block;
|
2013-08-15 19:44:27 -06:00
|
|
|
cursor: pointer;
|
2013-09-15 23:46:38 -06:00
|
|
|
font-size: 12px;
|
|
|
|
background: url(/doc/share.png) no-repeat;
|
|
|
|
background-position: right top;
|
|
|
|
padding: 5px 27px;
|
2013-08-15 19:44:27 -06:00
|
|
|
}
|
|
|
|
div#learn pre,
|
|
|
|
div#learn textarea {
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
font-family: Menlo, monospace;
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
|
|
|
div#learn .input {
|
|
|
|
padding: 10px;
|
|
|
|
margin-top: 10px;
|
|
|
|
height: 150px;
|
|
|
|
|
|
|
|
-webkit-border-top-left-radius: 5px;
|
|
|
|
-webkit-border-top-right-radius: 5px;
|
|
|
|
-moz-border-radius-topleft: 5px;
|
|
|
|
-moz-border-radius-topright: 5px;
|
|
|
|
border-top-left-radius: 5px;
|
|
|
|
border-top-right-radius: 5px;
|
|
|
|
}
|
|
|
|
div#learn .input textarea {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
border: none;
|
|
|
|
outline: none;
|
|
|
|
resize: none;
|
|
|
|
}
|
|
|
|
div#learn .output {
|
|
|
|
border-top: none !important;
|
|
|
|
|
|
|
|
padding: 10px;
|
|
|
|
height: 59px;
|
|
|
|
overflow: auto;
|
|
|
|
|
|
|
|
-webkit-border-bottom-right-radius: 5px;
|
|
|
|
-webkit-border-bottom-left-radius: 5px;
|
|
|
|
-moz-border-radius-bottomright: 5px;
|
|
|
|
-moz-border-radius-bottomleft: 5px;
|
|
|
|
border-bottom-right-radius: 5px;
|
|
|
|
border-bottom-left-radius: 5px;
|
|
|
|
}
|
|
|
|
div#learn .output pre {
|
|
|
|
padding: 0;
|
|
|
|
|
|
|
|
-webkit-border-radius: 0;
|
|
|
|
-moz-border-radius: 0;
|
|
|
|
border-radius: 0;
|
|
|
|
}
|
|
|
|
div#learn .input,
|
|
|
|
div#learn .input textarea,
|
|
|
|
div#learn .output,
|
|
|
|
div#learn .output pre {
|
|
|
|
background: #FFFFD8;
|
|
|
|
}
|
|
|
|
div#learn .input,
|
|
|
|
div#learn .output {
|
|
|
|
border: 1px solid #375EAB;
|
|
|
|
}
|
|
|
|
div#learn .buttons {
|
|
|
|
float: right;
|
|
|
|
padding: 20px 0 10px 0;
|
|
|
|
text-align: right;
|
|
|
|
}
|
|
|
|
div#learn .buttons a {
|
|
|
|
height: 16px;
|
|
|
|
margin-left: 5px;
|
|
|
|
padding: 10px;
|
|
|
|
}
|
|
|
|
div#learn .toys {
|
|
|
|
margin-top: 8px;
|
|
|
|
}
|
|
|
|
div#learn .toys select {
|
|
|
|
border: 1px solid #375EAB;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
div#learn .output .exit {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
div#blog,
|
|
|
|
div#video {
|
|
|
|
margin-top: 40px;
|
|
|
|
}
|
|
|
|
div#blog > a,
|
|
|
|
div#blog > div,
|
|
|
|
div#blog > h2,
|
|
|
|
div#video > a,
|
|
|
|
div#video > div,
|
|
|
|
div#video > h2 {
|
|
|
|
margin-bottom: 10px;
|
|
|
|
}
|
|
|
|
div#blog .title,
|
|
|
|
div#video .title {
|
|
|
|
display: block;
|
|
|
|
font-size: 20px;
|
|
|
|
}
|
|
|
|
div#blog .when {
|
|
|
|
color: #666;
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
|
|
|
div#blog .read {
|
|
|
|
text-align: right;
|
|
|
|
}
|
|
|
|
|
|
|
|
.toggleButton { cursor: pointer; }
|
|
|
|
.toggle .collapsed { display: block; }
|
|
|
|
.toggle .expanded { display: none; }
|
|
|
|
.toggleVisible .collapsed { display: none; }
|
|
|
|
.toggleVisible .expanded { display: block; }
|
|
|
|
|
|
|
|
table.codetable { margin-left: auto; margin-right: auto; border-style: none; }
|
|
|
|
table.codetable td { padding-right: 10px; }
|
|
|
|
hr { border-style: none; border-top: 1px solid black; }
|
|
|
|
|
|
|
|
img.gopher {
|
|
|
|
float: right;
|
|
|
|
margin-left: 10px;
|
|
|
|
margin-bottom: 10px;
|
|
|
|
z-index: -1;
|
|
|
|
}
|
|
|
|
.pkgGopher {
|
|
|
|
text-align: right;
|
|
|
|
}
|
|
|
|
.pkgGopher .gopher {
|
|
|
|
float: none;
|
|
|
|
position: relative;
|
|
|
|
top: -40px;
|
|
|
|
margin-bottom: -120px;
|
|
|
|
}
|
|
|
|
h2 { clear: right; }
|
|
|
|
|
|
|
|
/* example and drop-down playground */
|
|
|
|
div.play {
|
|
|
|
padding: 0 20px 40px 20px;
|
|
|
|
}
|
|
|
|
div.play pre,
|
|
|
|
div.play textarea,
|
|
|
|
div.play .lines {
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
font-family: Menlo, monospace;
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
|
|
|
div.play .input {
|
|
|
|
padding: 10px;
|
|
|
|
margin-top: 10px;
|
|
|
|
|
|
|
|
-webkit-border-top-left-radius: 5px;
|
|
|
|
-webkit-border-top-right-radius: 5px;
|
|
|
|
-moz-border-radius-topleft: 5px;
|
|
|
|
-moz-border-radius-topright: 5px;
|
|
|
|
border-top-left-radius: 5px;
|
|
|
|
border-top-right-radius: 5px;
|
|
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
div.play .input textarea {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
border: none;
|
|
|
|
outline: none;
|
|
|
|
resize: none;
|
|
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
div#playground .input textarea {
|
|
|
|
overflow: auto;
|
|
|
|
resize: auto;
|
|
|
|
}
|
|
|
|
div.play .output {
|
|
|
|
border-top: none !important;
|
|
|
|
|
|
|
|
padding: 10px;
|
|
|
|
max-height: 200px;
|
|
|
|
overflow: auto;
|
|
|
|
|
|
|
|
-webkit-border-bottom-right-radius: 5px;
|
|
|
|
-webkit-border-bottom-left-radius: 5px;
|
|
|
|
-moz-border-radius-bottomright: 5px;
|
|
|
|
-moz-border-radius-bottomleft: 5px;
|
|
|
|
border-bottom-right-radius: 5px;
|
|
|
|
border-bottom-left-radius: 5px;
|
|
|
|
}
|
|
|
|
div.play .output pre {
|
|
|
|
padding: 0;
|
|
|
|
|
|
|
|
-webkit-border-radius: 0;
|
|
|
|
-moz-border-radius: 0;
|
|
|
|
border-radius: 0;
|
|
|
|
}
|
|
|
|
div.play .input,
|
|
|
|
div.play .input textarea,
|
|
|
|
div.play .output,
|
|
|
|
div.play .output pre {
|
|
|
|
background: #FFFFD8;
|
|
|
|
}
|
|
|
|
div.play .input,
|
|
|
|
div.play .output {
|
|
|
|
border: 1px solid #375EAB;
|
|
|
|
}
|
|
|
|
div.play .buttons {
|
|
|
|
float: right;
|
|
|
|
padding: 20px 0 10px 0;
|
|
|
|
text-align: right;
|
|
|
|
}
|
|
|
|
div.play .buttons a {
|
|
|
|
height: 16px;
|
|
|
|
margin-left: 5px;
|
|
|
|
padding: 10px;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
.output .stderr {
|
|
|
|
color: #933;
|
|
|
|
}
|
|
|
|
.output .system {
|
|
|
|
color: #999;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* drop-down playground */
|
|
|
|
#playgroundButton,
|
|
|
|
div#playground {
|
|
|
|
/* start hidden; revealed by javascript */
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
div#playground {
|
|
|
|
position: absolute;
|
|
|
|
top: 63px;
|
|
|
|
right: 20px;
|
|
|
|
padding: 0 10px 10px 10px;
|
|
|
|
z-index: 1;
|
|
|
|
text-align: left;
|
|
|
|
background: #E0EBF5;
|
|
|
|
|
|
|
|
border: 1px solid #B0BBC5;
|
|
|
|
border-top: none;
|
|
|
|
|
|
|
|
-webkit-border-bottom-left-radius: 5px;
|
|
|
|
-webkit-border-bottom-right-radius: 5px;
|
|
|
|
-moz-border-radius-bottomleft: 5px;
|
|
|
|
-moz-border-radius-bottomright: 5px;
|
|
|
|
border-bottom-left-radius: 5px;
|
|
|
|
border-bottom-right-radius: 5px;
|
|
|
|
}
|
|
|
|
div#playground .code {
|
|
|
|
width: 520px;
|
|
|
|
height: 200px;
|
|
|
|
}
|
|
|
|
div#playground .output {
|
|
|
|
height: 100px;
|
|
|
|
}
|
2013-09-17 23:12:51 -06:00
|
|
|
|
|
|
|
/* Inline runnable snippets (play.js/initPlayground) */
|
|
|
|
#content .code pre, #content .playground pre, #content .output pre {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
background: none;
|
|
|
|
border: none;
|
2013-09-26 17:46:08 -06:00
|
|
|
outline: 0px solid transparent;
|
2013-09-17 23:12:51 -06:00
|
|
|
overflow: auto;
|
|
|
|
}
|
2013-09-26 17:46:08 -06:00
|
|
|
#content .playground .number, #content .code .number {
|
2013-09-17 23:12:51 -06:00
|
|
|
color: #999;
|
|
|
|
}
|
|
|
|
#content .code, #content .playground, #content .output {
|
|
|
|
width: auto;
|
|
|
|
margin: 20px;
|
|
|
|
padding: 10px;
|
|
|
|
-webkit-border-radius: 5px;
|
|
|
|
-moz-border-radius: 5px;
|
|
|
|
border-radius: 5px;
|
|
|
|
}
|
|
|
|
#content .code, #content .playground {
|
|
|
|
background: #e9e9e9;
|
|
|
|
}
|
|
|
|
#content .output {
|
|
|
|
background: #202020;
|
|
|
|
}
|
|
|
|
#content .output .stdout, #content .output pre {
|
|
|
|
color: #e6e6e6;
|
|
|
|
}
|
|
|
|
#content .output .stderr, #content .output .error {
|
|
|
|
color: rgb(244, 74, 63);
|
|
|
|
}
|
|
|
|
#content .output .system, #content .output .exit {
|
|
|
|
color: rgb(255, 209, 77)
|
|
|
|
}
|
|
|
|
#content .buttons {
|
|
|
|
position: relative;
|
|
|
|
float: right;
|
|
|
|
top: -50px;
|
|
|
|
right: 30px;
|
|
|
|
}
|
|
|
|
#content .output .buttons {
|
|
|
|
top: -60px;
|
|
|
|
right: 0;
|
|
|
|
height: 0;
|
|
|
|
}
|
|
|
|
#content .buttons .kill {
|
|
|
|
display: none;
|
|
|
|
visibility: hidden;
|
|
|
|
}
|
2013-08-15 19:44:27 -06:00
|
|
|
`,
|
|
|
|
}
|