Initial commit.

This commit is contained in:
gmp
2020-06-25 12:43:58 -04:00
commit fbe9009d23
50 changed files with 8804 additions and 0 deletions
@@ -0,0 +1,640 @@
// 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:
* + Generate a table of contents (generateTOC)
* + Bind foldable sections (bindToggles)
* + Bind links to foldable sections (bindToggleLinks)
*/
(function() {
'use strict';
// Mobile-friendly topbar menu
$(function() {
var menu = $('#menu');
var menuButton = $('#menu-button');
var menuButtonArrow = $('#menu-button-arrow');
menuButton.click(function(event) {
menu.toggleClass('menu-visible');
menuButtonArrow.toggleClass('vertical-flip');
event.preventDefault();
return false;
});
});
/* 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;
}
// For search, we send the toc precomputed from server-side.
// TODO: Ideally, this should always be precomputed for all pages, but then
// we need to do HTML parsing on the server-side.
if (location.pathname === '/search') {
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 class="indent"/>');
}
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 ($(this).closest(".toggle, .toggleVisible")[0] != el) {
// Only trigger the closest toggle header.
return;
}
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': '//play.golang.org/p/'
});
},
function() {
button.removeClass('active');
div.hide();
});
$('#menu').css('min-width', '+=60');
// Hide inline playground if we click somewhere on the page.
// This is needed in mobile devices, where the "Play" button
// is not clickable once the playground opens up.
$("#page").click(function() {
if (button.hasClass('active')) {
button.click();
}
});
}
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': '//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 id = window.location.hash.substring(1);
// Open all of the toggles for a particular hash.
var els = $(
document.getElementById(id),
$('a[name]').filter(function() {
return $(this).attr('name') == id;
})
);
while (els.length) {
for (var i = 0; i < els.length; i++) {
var el = $(els[i]);
if (el.is('.toggle')) {
el.find('.toggleButton').first().click();
}
}
els = el.parent();
}
}
function personalizeInstallInstructions() {
var prefix = '?download=';
var s = window.location.search;
if (s.indexOf(prefix) != 0) {
// No 'download' query string; detect "test" instructions from User Agent.
if (navigator.platform.indexOf('Win') != -1) {
$('.testUnix').hide();
$('.testWindows').show();
} else {
$('.testUnix').show();
$('.testWindows').hide();
}
return;
}
var filename = s.substr(prefix.length);
var filenameRE = /^go1\.\d+(\.\d+)?([a-z0-9]+)?\.([a-z0-9]+)(-[a-z0-9]+)?(-osx10\.[68])?\.([a-z.]+)$/;
var m = filenameRE.exec(filename);
if (!m) {
// Can't interpret file name; bail.
return;
}
$('.downloadFilename').text(filename);
$('.hideFromDownload').hide();
var os = m[3];
var ext = m[6];
if (ext != 'tar.gz') {
$('#tarballInstructions').hide();
}
if (os != 'darwin' || ext != 'pkg') {
$('#darwinPackageInstructions').hide();
}
if (os != 'windows') {
$('#windowsInstructions').hide();
$('.testUnix').show();
$('.testWindows').hide();
} else {
if (ext != 'msi') {
$('#windowsInstallerInstructions').hide();
}
if (ext != 'zip') {
$('#windowsZipInstructions').hide();
}
$('.testUnix').hide();
$('.testWindows').show();
}
var download = "https://dl.google.com/go/" + filename;
var message = $('<p class="downloading">'+
'Your download should begin shortly. '+
'If it does not, click <a>this link</a>.</p>');
message.find('a').attr('href', download);
message.insertAfter('#nav');
window.location = download;
}
function updateVersionTags() {
var v = window.goVersion;
if (/^go[0-9.]+$/.test(v)) {
$(".versionTag").empty().text(v);
$(".whereTag").hide();
}
}
function addPermalinks() {
function addPermalink(source, parent) {
var id = source.attr("id");
if (id == "" || id.indexOf("tmp_") === 0) {
// Auto-generated permalink.
return;
}
if (parent.find("> .permalink").length) {
// Already attached.
return;
}
parent.append(" ").append($("<a class='permalink'>&#xb6;</a>").attr("href", "#" + id));
}
$("#page .container").find("h2[id], h3[id]").each(function() {
var el = $(this);
addPermalink(el, el);
});
$("#page .container").find("dl[id]").each(function() {
var el = $(this);
// Add the anchor to the "dt" element.
addPermalink(el, el.find("> dt").first());
});
}
$(".js-expandAll").click(function() {
if ($(this).hasClass("collapsed")) {
toggleExamples('toggle');
$(this).text("(Collapse All)");
} else {
toggleExamples('toggleVisible');
$(this).text("(Expand All)");
}
$(this).toggleClass("collapsed")
});
function toggleExamples(className) {
// We need to explicitly iterate through divs starting with "example_"
// to avoid toggling Overview and Index collapsibles.
$("[id^='example_']").each(function() {
// Check for state and click it only if required.
if ($(this).hasClass(className)) {
$(this).find('.toggleButton').first().click();
}
});
}
$(document).ready(function() {
generateTOC();
addPermalinks();
bindToggles(".toggle");
bindToggles(".toggleVisible");
bindToggleLinks(".exampleLink", "example_");
bindToggleLinks(".overviewLink", "");
bindToggleLinks(".examplesLink", "");
bindToggleLinks(".indexLink", "");
setupDropdownPlayground();
setupInlinePlayground();
fixFocus();
setupTypeInfo();
setupCallgraphs();
toggleHash();
personalizeInstallInstructions();
updateVersionTags();
// 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]();
});
// -- analysis ---------------------------------------------------------
// escapeHTML returns HTML for s, with metacharacters quoted.
// It is safe for use in both elements and attributes
// (unlike the "set innerText, read innerHTML" trick).
function escapeHTML(s) {
return s.replace(/&/g, '&amp;').
replace(/\"/g, '&quot;').
replace(/\'/g, '&#39;').
replace(/</g, '&lt;').
replace(/>/g, '&gt;');
}
// makeAnchor returns HTML for an <a> element, given an anchorJSON object.
function makeAnchor(json) {
var html = escapeHTML(json.Text);
if (json.Href != "") {
html = "<a href='" + escapeHTML(json.Href) + "'>" + html + "</a>";
}
return html;
}
function showLowFrame(html) {
var lowframe = document.getElementById('lowframe');
lowframe.style.height = "200px";
lowframe.innerHTML = "<p style='text-align: left;'>" + html + "</p>\n" +
"<div onclick='hideLowFrame()' style='position: absolute; top: 0; right: 0; cursor: pointer;'>✘</div>"
};
document.hideLowFrame = function() {
var lowframe = document.getElementById('lowframe');
lowframe.style.height = "0px";
}
// onClickCallers is the onclick action for the 'func' tokens of a
// function declaration.
document.onClickCallers = function(index) {
var data = document.ANALYSIS_DATA[index]
if (data.Callers.length == 1 && data.Callers[0].Sites.length == 1) {
document.location = data.Callers[0].Sites[0].Href; // jump to sole caller
return;
}
var html = "Callers of <code>" + escapeHTML(data.Callee) + "</code>:<br/>\n";
for (var i = 0; i < data.Callers.length; i++) {
var caller = data.Callers[i];
html += "<code>" + escapeHTML(caller.Func) + "</code>";
var sites = caller.Sites;
if (sites != null && sites.length > 0) {
html += " at line ";
for (var j = 0; j < sites.length; j++) {
if (j > 0) {
html += ", ";
}
html += "<code>" + makeAnchor(sites[j]) + "</code>";
}
}
html += "<br/>\n";
}
showLowFrame(html);
};
// onClickCallees is the onclick action for the '(' token of a function call.
document.onClickCallees = function(index) {
var data = document.ANALYSIS_DATA[index]
if (data.Callees.length == 1) {
document.location = data.Callees[0].Href; // jump to sole callee
return;
}
var html = "Callees of this " + escapeHTML(data.Descr) + ":<br/>\n";
for (var i = 0; i < data.Callees.length; i++) {
html += "<code>" + makeAnchor(data.Callees[i]) + "</code><br/>\n";
}
showLowFrame(html);
};
// onClickTypeInfo is the onclick action for identifiers declaring a named type.
document.onClickTypeInfo = function(index) {
var data = document.ANALYSIS_DATA[index];
var html = "Type <code>" + data.Name + "</code>: " +
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<small>(size=" + data.Size + ", align=" + data.Align + ")</small><br/>\n";
html += implementsHTML(data);
html += methodsetHTML(data);
showLowFrame(html);
};
// implementsHTML returns HTML for the implements relation of the
// specified TypeInfoJSON value.
function implementsHTML(info) {
var html = "";
if (info.ImplGroups != null) {
for (var i = 0; i < info.ImplGroups.length; i++) {
var group = info.ImplGroups[i];
var x = "<code>" + escapeHTML(group.Descr) + "</code> ";
for (var j = 0; j < group.Facts.length; j++) {
var fact = group.Facts[j];
var y = "<code>" + makeAnchor(fact.Other) + "</code>";
if (fact.ByKind != null) {
html += escapeHTML(fact.ByKind) + " type " + y + " implements " + x;
} else {
html += x + " implements " + y;
}
html += "<br/>\n";
}
}
}
return html;
}
// methodsetHTML returns HTML for the methodset of the specified
// TypeInfoJSON value.
function methodsetHTML(info) {
var html = "";
if (info.Methods != null) {
for (var i = 0; i < info.Methods.length; i++) {
html += "<code>" + makeAnchor(info.Methods[i]) + "</code><br/>\n";
}
}
return html;
}
// onClickComm is the onclick action for channel "make" and "<-"
// send/receive tokens.
document.onClickComm = function(index) {
var ops = document.ANALYSIS_DATA[index].Ops
if (ops.length == 1) {
document.location = ops[0].Op.Href; // jump to sole element
return;
}
var html = "Operations on this channel:<br/>\n";
for (var i = 0; i < ops.length; i++) {
html += makeAnchor(ops[i].Op) + " by <code>" + escapeHTML(ops[i].Fn) + "</code><br/>\n";
}
if (ops.length == 0) {
html += "(none)<br/>\n";
}
showLowFrame(html);
};
$(window).load(function() {
// Scroll window so that first selection is visible.
// (This means we don't need to emit id='L%d' spans for each line.)
// TODO(adonovan): ideally, scroll it so that it's under the pointer,
// but I don't know how to get the pointer y coordinate.
var elts = document.getElementsByClassName("selection");
if (elts.length > 0) {
elts[0].scrollIntoView()
}
});
// setupTypeInfo populates the "Implements" and "Method set" toggle for
// each type in the package doc.
function setupTypeInfo() {
for (var i in document.ANALYSIS_DATA) {
var data = document.ANALYSIS_DATA[i];
var el = document.getElementById("implements-" + i);
if (el != null) {
// el != null => data is TypeInfoJSON.
if (data.ImplGroups != null) {
el.innerHTML = implementsHTML(data);
el.parentNode.parentNode.style.display = "block";
}
}
var el = document.getElementById("methodset-" + i);
if (el != null) {
// el != null => data is TypeInfoJSON.
if (data.Methods != null) {
el.innerHTML = methodsetHTML(data);
el.parentNode.parentNode.style.display = "block";
}
}
}
}
function setupCallgraphs() {
if (document.CALLGRAPH == null) {
return
}
document.getElementById("pkg-callgraph").style.display = "block";
var treeviews = document.getElementsByClassName("treeview");
for (var i = 0; i < treeviews.length; i++) {
var tree = treeviews[i];
if (tree.id == null || tree.id.indexOf("callgraph-") != 0) {
continue;
}
var id = tree.id.substring("callgraph-".length);
$(tree).treeview({collapsed: true, animated: "fast"});
document.cgAddChildren(tree, tree, [id]);
tree.parentNode.parentNode.style.display = "block";
}
}
document.cgAddChildren = function(tree, ul, indices) {
if (indices != null) {
for (var i = 0; i < indices.length; i++) {
var li = cgAddChild(tree, ul, document.CALLGRAPH[indices[i]]);
if (i == indices.length - 1) {
$(li).addClass("last");
}
}
}
$(tree).treeview({animated: "fast", add: ul});
}
// cgAddChild adds an <li> element for document.CALLGRAPH node cgn to
// the parent <ul> element ul. tree is the tree's root <ul> element.
function cgAddChild(tree, ul, cgn) {
var li = document.createElement("li");
ul.appendChild(li);
li.className = "closed";
var code = document.createElement("code");
if (cgn.Callees != null) {
$(li).addClass("expandable");
// Event handlers and innerHTML updates don't play nicely together,
// hence all this explicit DOM manipulation.
var hitarea = document.createElement("div");
hitarea.className = "hitarea expandable-hitarea";
li.appendChild(hitarea);
li.appendChild(code);
var childUL = document.createElement("ul");
li.appendChild(childUL);
childUL.setAttribute('style', "display: none;");
var onClick = function() {
document.cgAddChildren(tree, childUL, cgn.Callees);
hitarea.removeEventListener('click', onClick)
};
hitarea.addEventListener('click', onClick);
} else {
li.appendChild(code);
}
code.innerHTML += "&nbsp;" + makeAnchor(cgn.Func);
return li
}
})();
File diff suppressed because one or more lines are too long
@@ -0,0 +1,872 @@
body {
margin: 0;
font-family: Arial, sans-serif;
background-color: #fff;
line-height: 1.3;
text-align: center;
color: #222;
}
textarea {
/* Inherit text color from body avoiding illegible text in the case where the
* user has inverted the browsers custom text and background colors. */
color: inherit;
}
pre,
code {
font-family: Menlo, monospace;
font-size: 0.875rem;
}
pre {
line-height: 1.4;
overflow-x: auto;
}
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;
background: #efefef;
}
.ln {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
/* Ensure 8 characters in the document - which due to floating
* point rendering issues, might have a width of less than 1 each - are 8
* characters wide, so a tab in the 9th position indents properly. See
* https://github.com/webcompat/web-bugs/issues/17530#issuecomment-402675091
* for more information. */
display: inline-block;
width: 8ch;
}
.search-nav{
margin-left: 1.25rem;
font-size: 0.875rem;
column-gap: 1.25rem;
column-fill: auto;
column-width: 14rem;
}
.search-nav .indent {
margin-left: 1.25rem;
}
a,
.exampleHeading .text,
.expandAll {
color: #375EAB;
text-decoration: none;
}
a:hover,
.exampleHeading .text:hover,
.expandAll:hover {
text-decoration: underline;
}
.article a {
text-decoration: underline;
}
.article .title a {
text-decoration: none;
}
.permalink {
display: none;
}
:hover > .permalink {
display: inline;
}
p, li {
max-width: 50rem;
word-wrap: break-word;
}
p,
pre,
ul,
ol {
margin: 1.25rem;
}
pre {
background: #EFEFEF;
padding: 0.625rem;
border-radius: 0.3125rem;
}
h1,
h2,
h3,
h4,
.rootHeading {
margin: 1.25rem 0 1.25rem;
padding: 0;
color: #375EAB;
font-weight: bold;
}
h1 {
font-size: 1.75rem;
line-height: 1;
}
h1 .text-muted {
color:#777;
}
h2 {
font-size: 1.25rem;
background: #E0EBF5;
padding: 0.5rem;
line-height: 1.25;
font-weight: normal;
overflow: auto;
overflow-wrap: break-word;
}
h2 a {
font-weight: bold;
}
h3 {
font-size: 1.25rem;
line-height: 1.25;
overflow: auto;
overflow-wrap: break-word;
}
h3,
h4 {
margin: 1.25rem 0.3125rem;
}
h4 {
font-size: 1rem;
}
.rootHeading {
font-size: 1.25rem;
margin: 0;
}
h2 > span,
h3 > span {
float: right;
margin: 0 25px 0 0;
font-weight: normal;
color: #5279C7;
}
dl {
margin: 1.25rem;
}
dd {
margin: 0 0 0 1.25rem;
}
dl,
dd {
font-size: 0.875rem;
}
div#nav table td {
vertical-align: top;
}
#pkg-index h3 {
font-size: 1rem;
}
.pkg-dir {
padding: 0 0.625rem;
}
.pkg-dir table {
border-collapse: collapse;
border-spacing: 0;
}
.pkg-name {
padding-right: 0.625rem;
}
.alert {
color: #AA0000;
}
.top-heading {
float: left;
padding: 1.313rem 0;
font-size: 1.25rem;
font-weight: normal;
}
.top-heading a {
color: #222;
text-decoration: none;
}
#pkg-examples h3 {
float: left;
}
#pkg-examples dl {
clear: both;
}
.expandAll {
cursor: pointer;
float: left;
margin: 1.25rem 0;
}
div#topbar {
background: #E0EBF5;
height: 4rem;
overflow: hidden;
}
div#page {
width: 100%;
}
div#page > .container,
div#topbar > .container {
text-align: left;
margin-left: auto;
margin-right: auto;
padding: 0 1.25rem;
}
div#topbar > .container,
div#page > .container {
max-width: 59.38rem;
}
div#page.wide > .container,
div#topbar.wide > .container {
max-width: none;
}
div#plusone {
float: right;
clear: right;
margin-top: 0.3125rem;
}
div#footer {
text-align: center;
color: #666;
font-size: 0.875rem;
margin: 2.5rem 0;
}
div#menu > a,
input#search,
div#learn .buttons a,
div.play .buttons a,
div#blog .read a,
#menu-button {
padding: 0.625rem;
text-decoration: none;
font-size: 1rem;
border-radius: 0.3125rem;
}
div#playground .buttons a,
div#menu > a,
input#search,
#menu-button {
border: 0.0625rem solid #375EAB;
}
div#playground .buttons a,
div#menu > a,
#menu-button {
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: 0.0625rem solid #375EAB;
background: #E0EBF5;
}
.download {
width: 9.375rem;
}
div#menu {
text-align: right;
padding: 0.625rem;
white-space: nowrap;
max-height: 0;
-moz-transition: max-height .25s linear;
transition: max-height .25s linear;
width: 100%;
}
div#menu.menu-visible {
max-height: 31.25rem;
}
div#menu > a,
#menu-button {
margin: 0.625rem 0.125rem;
padding: 0.625rem;
}
::-webkit-input-placeholder {
color: #7f7f7f;
opacity: 1;
}
::placeholder {
color: #7f7f7f;
opacity: 1;
}
#menu .search-box {
display: inline-flex;
width: 8.75rem;
}
input#search {
background: white;
color: #222;
box-sizing: border-box;
-webkit-appearance: none;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-right: 0;
margin-right: 0;
flex-grow: 1;
max-width: 100%;
min-width: 5.625rem;
}
input#search:-webkit-search-decoration {
-webkit-appearance: none;
}
input#search:-moz-ui-invalid {
box-shadow: unset;
}
input#search + button {
display: inline;
font-size: 1em;
background-color: #375EAB;
color: white;
border: 0.0625rem solid #375EAB;
border-top-left-radius: 0;
border-top-right-radius: 0.3125rem;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0.3125rem;
margin-left: 0;
cursor: pointer;
}
input#search + button span {
display: flex;
}
input#search + button svg {
fill: white
}
#menu-button {
display: none;
position: absolute;
right: 0.3125rem;
top: 0;
margin-right: 0.3125rem;
}
#menu-button-arrow {
display: inline-block;
}
.vertical-flip {
transform: rotate(-180deg);
}
div.left {
float: left;
clear: left;
margin-right: 2.5%;
}
div.right {
float: right;
clear: right;
margin-left: 2.5%;
}
div.left,
div.right {
width: 45%;
}
div#learn,
div#about {
padding-top: 1.25rem;
}
div#learn h2,
div#about {
margin: 0;
}
div#about {
font-size: 1.25rem;
margin: 0 auto 1.875rem;
}
div#gopher {
background: url(/doc/gopher/frontpage.png) no-repeat;
background-position: center top;
height: 9.688rem;
max-height: 200px; /* Setting in px to prevent the gopher from blowing up in very high default font-sizes */
}
a#start {
display: block;
padding: 0.625rem;
text-align: center;
text-decoration: none;
border-radius: 0.3125rem;
}
a#start .big {
display: block;
font-weight: bold;
font-size: 1.25rem;
}
a#start .desc {
display: block;
font-size: 0.875rem;
font-weight: normal;
margin-top: 0.3125rem;
}
div#learn .popout {
float: right;
display: block;
cursor: pointer;
font-size: 0.75rem;
background: url(/doc/share.png) no-repeat;
background-position: right center;
padding: 0.375rem 1.688rem;
}
div#learn pre,
div#learn textarea {
padding: 0;
margin: 0;
font-family: Menlo, monospace;
font-size: 0.875rem;
}
div#learn .input {
padding: 0.625rem;
margin-top: 0.625rem;
height: 9.375rem;
border-top-left-radius: 0.3125rem;
border-top-right-radius: 0.3125rem;
}
div#learn .input textarea {
width: 100%;
height: 100%;
border: none;
outline: none;
resize: none;
}
div#learn .output {
border-top: none !important;
padding: 0.625rem;
height: 3.688rem;
overflow: auto;
border-bottom-right-radius: 0.3125rem;
border-bottom-left-radius: 0.3125rem;
}
div#learn .output pre {
padding: 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: 0.0625rem solid #375EAB;
}
div#learn .buttons {
float: right;
padding: 1.25rem 0 0.625rem 0;
text-align: right;
}
div#learn .buttons a {
height: 1rem;
margin-left: 0.3125rem;
padding: 0.625rem;
}
div#learn .toys {
margin-top: 0.5rem;
}
div#learn .toys select {
font-size: 0.875rem;
border: 0.0625rem solid #375EAB;
margin: 0;
}
div#learn .output .exit {
display: none;
}
div#video {
max-width: 100%;
}
div#blog,
div#video {
margin-top: 2.5rem;
}
div#blog > a,
div#blog > div,
div#blog > h2,
div#video > a,
div#video > div,
div#video > h2 {
margin-bottom: 0.625rem;
}
div#blog .title,
div#video .title {
display: block;
font-size: 1.25rem;
}
div#blog .when {
color: #666;
font-size: 0.875rem;
}
div#blog .read {
text-align: right;
}
@supports (--c: 0) {
[style*="--aspect-ratio-padding:"] {
position: relative;
overflow: hidden;
padding-top: var(--aspect-ratio-padding);
}
[style*="--aspect-ratio-padding:"]>* {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
.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: 0.625rem; }
hr { border-style: none; border-top: 0.0625rem solid black; }
img.gopher {
float: right;
margin-left: 0.625rem;
margin-bottom: 0.625rem;
z-index: -1;
}
h2 { clear: right; }
/* example and drop-down playground */
div.play {
padding: 0 1.25rem 2.5rem 1.25rem;
}
div.play pre,
div.play textarea,
div.play .lines {
padding: 0;
margin: 0;
font-family: Menlo, monospace;
font-size: 0.875rem;
}
div.play .input {
padding: 0.625rem;
margin-top: 0.625rem;
border-top-left-radius: 0.3125rem;
border-top-right-radius: 0.3125rem;
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: 0.625rem;
max-height: 12.5rem;
overflow: auto;
border-bottom-right-radius: 0.3125rem;
border-bottom-left-radius: 0.3125rem;
}
div.play .output pre {
padding: 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: 0.0625rem solid #375EAB;
}
div.play .buttons {
float: right;
padding: 1.25rem 0 0.625rem 0;
text-align: right;
}
div.play .buttons a {
height: 1rem;
margin-left: 0.3125rem;
padding: 0.625rem;
cursor: pointer;
}
.output .stderr {
color: #933;
}
.output .system {
color: #999;
}
/* drop-down playground */
div#playground {
/* start hidden; revealed by javascript */
display: none;
}
div#playground {
position: absolute;
top: 3.938rem;
right: 1.25rem;
padding: 0 0.625rem 0.625rem 0.625rem;
z-index: 1;
text-align: left;
background: #E0EBF5;
border: 0.0625rem solid #B0BBC5;
border-top: none;
border-bottom-left-radius: 0.3125rem;
border-bottom-right-radius: 0.3125rem;
}
div#playground .code {
width: 32.5rem;
height: 12.5rem;
}
div#playground .output {
height: 6.25rem;
}
/* Inline runnable snippets (play.js/initPlayground) */
#content .code pre, #content .playground pre, #content .output pre {
margin: 0;
padding: 0;
background: none;
border: none;
outline: 0 solid transparent;
overflow: auto;
}
#content .playground .number, #content .code .number {
color: #999;
}
#content .code, #content .playground, #content .output {
width: auto;
margin: 1.25rem;
padding: 0.625rem;
border-radius: 0.3125rem;
}
#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: -3.125rem;
right: 1.875rem;
}
#content .output .buttons {
top: -3.75rem;
right: 0;
height: 0;
}
#content .buttons .kill {
display: none;
visibility: hidden;
}
a.error {
font-weight: bold;
color: white;
background-color: darkred;
border-bottom-left-radius: 0.25rem;
border-bottom-right-radius: 0.25rem;
border-top-left-radius: 0.25rem;
border-top-right-radius: 0.25rem;
padding: 0.125rem 0.25rem 0.125rem 0.25rem; /* TRBL */
}
#heading-narrow {
display: none;
}
.downloading {
background: #F9F9BE;
padding: 0.625rem;
text-align: center;
border-radius: 0.3125rem;
}
@media (max-width: 58.125em) {
#heading-wide {
display: none;
}
#heading-narrow {
display: block;
}
}
@media (max-width: 47.5em) {
.container .left,
.container .right {
width: auto;
float: none;
}
div#about {
max-width: 31.25rem;
text-align: center;
}
}
@media (min-width: 43.75em) and (max-width: 62.5em) {
div#menu > a {
margin: 0.3125rem 0;
font-size: 0.875rem;
}
input#search {
font-size: 0.875rem;
}
}
@media (max-width: 43.75em) {
body {
font-size: 0.9375rem;
}
div#playground {
left: 0;
right: 0;
}
pre,
code {
font-size: 0.866rem;
}
div#page > .container {
padding: 0 0.625rem;
}
div#topbar {
height: auto;
padding: 0.625rem;
}
div#topbar > .container {
padding: 0;
}
#heading-wide {
display: block;
}
#heading-narrow {
display: none;
}
.top-heading {
float: none;
display: inline-block;
padding: 0.75rem;
}
div#menu {
padding: 0;
min-width: 0;
text-align: left;
float: left;
}
div#menu > a {
display: block;
margin-left: 0;
margin-right: 0;
}
#menu .search-box {
display: flex;
width: 100%;
}
#menu-button {
display: inline-block;
}
p,
pre,
ul,
ol {
margin: 0.625rem;
}
.pkg-synopsis {
display: none;
}
img.gopher {
display: none;
}
}
@media (max-width: 30em) {
#heading-wide {
display: none;
}
#heading-narrow {
display: block;
}
}
@media print {
pre {
background: #FFF;
border: 0.0625rem solid #BBB;
white-space: pre-wrap;
}
}