blob: 4d6a67cb272d43fb26f1c6fea45b7d1c88e1dc11 [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_LATESTCLASS$$"
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-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" href="{{$header.URL}}?tab={{.Name}}"
{{if .Disabled}}aria-disabled="true"{{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{{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" href="{{$header.URL}}?tab={{.Name}}"
{{if .Disabled}}aria-disabled="true"{{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{{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"}}
<script>
loadScript('/static/js/details.min.js');
</script>
{{block "details_post_content" .}}{{end}}
{{end}}