blob: f50e1a0c8db9d51e0abe76b9ee80eccff2d3c432 [file] [log] [blame]
<!--
Copyright 2019 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
{{define "main_content"}}
<div class="Container">
<a class="GodocButton" href="{{.GodocURL}}">Back to godoc.org</a>
{{$header := .Header}}
{{$pageType := .PageType}}
<header class="DetailsHeader">
<div class="DetailsHeader-breadcrumb">
{{with .Breadcrumb}}
{{range .Links}}
<a href="{{.Href}}">{{.Body}}</a>
<span class="DetailsHeader-breadcrumbDivider">/</span>
{{end}}
<span class="DetailsHeader-breadcrumbCurrent">{{.Current}}</span>
{{if .CopyData}}
<button class="CopyToClipboardButton js-copyToClipboard"
title="Copy path to clipboard"
aria-label="Copy path to clipboard"
data-to-copy="{{.CopyData}}">
<img class="CopyToClipboardButton-image" src="/static/img/copy-click.svg" alt="">
</button>
{{end}}
{{end}}
</div>
<div class="DetailsHeader-main">
<h1 class="DetailsHeader-title">
{{if eq .PageType "std"}}
Standard library
{{else}}
{{if eq $pageType "mod"}}
Module
{{else if eq $pageType "dir"}}
Directory
{{else if eq $pageType "pkg"}}
Package
{{else if eq $pageType "cmd"}}
Command
{{end}}
{{.Name}}
{{end}}
</h1>
<div class="DetailsHeader-version">{{$header.DisplayVersion}}</div>
{{$ppath := ""}}
{{if and (ne $pageType "mod") (ne $pageType "std")}}
{{$ppath = $header.Path}}
{{end}}
<!-- Do not reformat the data attributes of the following div: the server uses a regexp to extract them. -->
<div class="DetailsHeader-badge $$GODISCOVERY_LATESTMINORCLASS$$"
data-version="{{$header.LinkVersion}}" data-mpath="{{$header.ModulePath}}" data-ppath="{{$ppath}}" data-pagetype="{{$pageType}}">
<span>Latest</span>
<a href="{{$header.LatestURL}}">Go to latest</a>
</div>
</div>
<div class="DetailsHeader-banner $$GODISCOVERY_LATESTMAJORCLASS$$">
<svg class="DetailsHeader-infoIcon" fill="currentcolor" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 426.667 426.667" style="enable-background:new 0 0 426.667 426.667;" xml:space="preserve">
<rect x="192" y="192" width="42.667" height="128"/>
<path d="M213.333,0C95.467,0,0,95.467,0,213.333s95.467,213.333,213.333,213.333S426.667,331.2,426.667,213.333
S331.2,0,213.333,0z M213.333,384c-94.08,0-170.667-76.587-170.667-170.667S119.253,42.667,213.333,42.667
S384,119.253,384,213.333S307.413,384,213.333,384z"/>
<rect x="192" y="106.667" width="42.667" height="42.667"/>
</svg>
<p>
The latest major version is <a href="/$$GODISCOVERY_LATESTMAJORVERSIONURL$$">$$GODISCOVERY_LATESTMAJORVERSION$$</a>.
</p>
</div>
<div class="DetailsHeader-infoLabel">
<span class="DetailsHeader-infoLabelTitle">Published:</span>
<strong>{{$header.CommitTime}}</strong>
<span class="DetailsHeader-infoLabelDivider">|</span>
<span class="DetailsHeader-infoLabelTitle">{{pluralize (len $header.Licenses) "License"}}: </span>
<span data-test-id="DetailsHeader-infoLabelLicense">
{{range $i, $e := $header.Licenses}}{{if $i}}, {{end}}
<a href="{{$header.URL}}?tab=licenses#{{.Anchor}}">{{$e.Type}}</a>
{{else}}
<span>None detected</span>
<a href="/license-policy" class="Disclaimer-link"><em>not legal advice</em></a>
{{end}}
</span>
{{if or (eq $pageType "pkg") (eq $pageType "dir") (eq $pageType "cmd")}}
<span class="DetailsHeader-infoLabelDivider">|</span>
{{if eq $header.ModulePath "std"}}
<a data-test-id="DetailsHeader-infoLabelModule" href="{{$header.Module.URL}}">Standard library</a>
{{else}}
<span class="DetailsHeader-infoLabelTitle">Module: </span>
<span>
<a data-test-id="DetailsHeader-infoLabelModule" href="{{$header.Module.URL}}">{{$header.ModulePath}}</a>
</span>
{{end}}
{{end}}
</div>
</header>
<nav class="DetailsNav js-fixedHeaderSentinel js-overflowingTabList">
<div role="tablist">
{{range .Tabs}}
<a role="tab"
{{if .Disabled}}
aria-disabled="true"
{{else if eq .Name "doc"}}
href="{{$header.URL}}"
{{else}}
href="{{$header.URL}}?tab={{.Name}}"
{{end}}
{{if eq .Name $.Settings.Name}}
aria-selected="true"
{{else}}
aria-selected="false"
{{end}}
>{{.DisplayName}}</a>
{{end}}
</div>
<div class="DetailsNav-overflowContainer">
<svg class="DetailsNav-overflowImage" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>
</svg>
<select class="DetailsNav-overflowSelect" aria-label="More">
{{range .Tabs}}
<option
value="{{$header.URL}}?tab={{.Name}}"
{{if .Disabled}}
disabled
data-always-disabled="true"
{{end}}
{{if eq .Name $.Settings.Name}}selected{{end}}
>{{.DisplayName}}</option>
{{end}}
</select>
</div>
</nav>
<div class="DetailsNavFixed js-fixedHeader" aria-hidden="true">
<div class="DetailsNavFixed-container">
<a href="https://go.dev/" class="DetailsNavFixed-logoLink">
<img class="DetailsNavFixed-logo" src="/static/img/go-logo-blue.svg" alt="Go">
</a>
<div class="DetailsNavFixed-moduleInfo">
<span class="DetailsNavFixed-title">
{{if ne $pageType "std"}}
<span class="DetailsNavFixed-titleType">
{{if eq $pageType "mod"}}
Module
{{else if eq $pageType "dir"}}
Directory
{{else if eq $pageType "pkg"}}
Package
{{else if eq $pageType "cmd"}}
Command
{{end}}
</span>
<span class="DetailsNavFixed-titleName">{{.Name}}</span>
{{else}}
<span class="DetailsNavFixed-titleType">Standard library</span>
<span class="DetailsNavFixed-titleType DetailsNavFixed-titleType--small">StdLib</span>
{{end}}
</span>
{{with .Breadcrumb}}
{{if .CopyData}}
<button class="CopyToClipboardButton js-copyToClipboard"
title="Copy path to clipboard"
aria-label="Copy path to clipboard"
data-to-copy="{{.CopyData}}">
<img class="CopyToClipboardButton-image" src="/static/img/copy-click.svg" alt="">
</button>
{{end}}
{{end}}
<div class="DetailsNavFixed-version">{{$header.DisplayVersion}}</div>
</div>
<div class="DetailsNavFixed-overflowingTabList js-overflowingTabList">
<div role="tablist">
{{range .Tabs}}
<a role="tab"
{{if .Disabled}}
aria-disabled="true"
{{else}}
href="{{$header.URL}}?tab={{.Name}}"
{{end}}
{{if eq .Name $.Settings.Name}}
aria-selected="true"
{{else}}
aria-selected="false"
{{end}}
>{{.DisplayName}}</a>
{{end}}
</div>
<div class="DetailsNavFixed-overflowContainer">
<svg class="DetailsNavFixed-overflowImage" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>
</svg>
<select class="DetailsNavFixed-overflowSelect" aria-label="More">
{{range .Tabs}}
<option
value="{{$header.URL}}?tab={{.Name}}"
{{if .Disabled}}
disabled
data-always-disabled="true"
{{end}}
{{if eq .Name $.Settings.Name}}selected{{end}}
>{{.DisplayName}}</option>
{{end}}
</select>
</div>
</div>
</div>
</div>
<div class="DetailsContent">
{{if .CanShowDetails}}
{{template "details_content" .Details}}
{{else}}
<h2>“{{.Settings.DisplayName}}” not displayed due to license restrictions.</h2>
See our <a href="/license-policy">license policy</a>.
{{end}}
</div>
</div>
{{end}}
{{define "post_content"}}
<div class="js-canonicalURLPath" data-canonical-url-path="{{.CanonicalURLPath}}" hidden />
<script>
loadScript('/static/js/details.min.js');
</script>
{{block "details_post_content" .}}{{end}}
{{end}}