Merge commit '35dec7c96f7ee3eb17dd444f7067f0c776fb56ae'

This commit is contained in:
Bjørn Erik Pedersen
2023-12-04 15:24:01 +01:00
810 changed files with 24147 additions and 7766 deletions

View File

@@ -0,0 +1,7 @@
@media print {
#page-footer,
body > footer,
body > nav {
display: none;
}
}

View File

@@ -0,0 +1,11 @@
#right-sidebar {
scrollbar-width: none; /* hide scrollbar: Firefox */
-ms-overflow-style: none; /* hide scrollbar: Internet Explorer 10+ */
height: calc(100vh - 9rem);
overflow-y: auto;
}
#right-sidebar::-webkit-scrollbar { /* hide scrollbar: WebKit */
width: 0;
height: 0;
}

View File

@@ -0,0 +1,20 @@
/*
Make h6 elements behave like dt elements. Initially implemented to support
linkable glossary entries.
Yes, it's a hack. That's why it's in the shame file.
*/
h6 {
margin-top: 0;
margin-bottom: 0;
font-size: 1.125rem;
}
h6:first-of-type {
margin-top: 3em;
}
h6 ~ p {
margin: 0.5em 0 2em 0;
}

View File

@@ -21,18 +21,18 @@
@import '_no-js';
@import '_social-icons';
@import '_stickyheader';
@import '_right-sidebar';
@import '_svg';
@import '_chroma';
@import '_variables';
@import '_print';
@import '_shame';
.nested-blockquote blockquote {
border-left: 4px solid var(--primary-color);
padding-left: 1em;
/*margin: 0;*/
}
.mw-90 {
max-width:90%;
}

View File

@@ -5174,6 +5174,16 @@ code, .code, pre code, .highlight pre {
right:0;
}
}
#right-sidebar {
scrollbar-width: none; /* hide scrollbar: Firefox */
-ms-overflow-style: none; /* hide scrollbar: Internet Explorer 10+ */
height: calc(100vh - 9rem);
overflow-y: auto;
}
#right-sidebar::-webkit-scrollbar { /* hide scrollbar: WebKit */
width: 0;
height: 0;
}
.fill-current { fill: currentColor; }
/* Background */
.chroma { background-color: #ffffff }
@@ -5305,10 +5315,33 @@ code, .code, pre code, .highlight pre {
.chroma .gt { color: #aa0000 }
/* TextWhitespace */
.chroma .w { color: #bbbbbb }
@media print {
#page-footer,
body > footer,
body > nav {
display: none;
}
}
/*
Make h6 elements behave like dt elements. Initially implemented to support
linkable glossary entries.
Yes, it's a hack. That's why it's in the shame file.
*/
h6 {
margin-top: 0;
margin-bottom: 0;
font-size: 1.125rem;
}
h6:first-of-type {
margin-top: 3em;
}
h6 ~ p {
margin: 0.5em 0 2em 0;
}
.nested-blockquote blockquote {
border-left: 4px solid #0594CB;
padding-left: 1em;
/*margin: 0;*/
}
.mw-90 {
max-width:90%;

View File

@@ -0,0 +1,4 @@
<pre class="mermaid">
{{- .Inner | safeHTML }}
</pre>
{{ .Page.Store.Set "hasMermaid" true }}

View File

@@ -1,5 +1,5 @@
<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }}
{{- if and (ge .Level 2) (le .Level 4) }}{{" " -}}
{{- if in (slice 2 3 4 6) .Level }}{{" " -}}
<a class="header-link" href="#{{ .Anchor | safeURL }}"><svg class="fill-current o-60 hover-accent-color-light" height="22px" viewBox="0 0 24 24" width="22px" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"/><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg></a>
{{- end -}}
</h{{ .Level }}>

View File

@@ -0,0 +1,250 @@
{{- /* Last modified: 2023-09-04T09:23:04-07:00 */}}
{{- /*
Copyright 2023 Veriphor LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
*/}}
{{- /*
This render hook resolves internal destinations by looking for a matching:
1. Content page
2. Page resource (a file in the current page bundle)
3. Section resource (a file in the current section)
4. Global resource (a file in the assets directory)
It skips the section resource lookup if the current page is a leaf bundle.
External destinations are not modified.
You must place global resources in the assets directory. If you have placed
your resources in the static directory, and you are unable or unwilling to move
them, you must mount the static directory to the assets directory by including
both of these entries in your site configuration:
[[module.mounts]]
source = 'assets'
target = 'assets'
[[module.mounts]]
source = 'static'
target = 'assets'
By default, if this render hook is unable to resolve a destination, including a
fragment if present, it passes the destination through without modification. To
emit a warning or error, set the error level in your site configuration:
[params.render_hooks.link]
errorLevel = 'warning' # ignore (default), warning, or error (fails the build)
When you set the error level to warning, and you are in a development
environment, you can visually highlight broken internal links:
[params.render_hooks.link]
errorLevel = 'warning' # ignore (default), warning, or error (fails the build)
highlightBroken = true # true or false (default)
This will add a "broken" class to anchor elements with invalid src attributes.
Add a rule to your CSS targeting the broken links:
a.broken {
background: #ff0;
border: 2px solid #f00;
padding: 0.1em 0.2em;
}
This render hook may be unable to resolve destinations created with the ref and
relref shortcodes. Unless you set the error level to ignore you should not use
either of these shortcodes in conjunction with this render hook.
@context {string} Destination The link destination.
@context {page} Page A reference to the page containing the link.
@context {string} PlainText The link description as plain text.
@context {string} Text The link description.
@context {string} Title The link title.
@returns {template.html}
*/}}
{{- /* Initialize. */}}
{{- $renderHookName := "link" }}
{{- /* Verify minimum required version. */}}
{{- $minHugoVersion := "0.120.0" }}
{{- if lt hugo.Version $minHugoVersion }}
{{- errorf "The %q render hook requires Hugo v%s or later." $renderHookName $minHugoVersion }}
{{- end }}
{{- /* Error level when unable to resolve destination: ignore, warning, or error. */}}
{{- $errorLevel := or site.Params.render_hooks.link.errorLevel "ignore" | lower }}
{{- /* If true, adds "broken" class to broken links. Applicable in development environment when errorLevel is warning. */}}
{{- $highlightBrokenLinks := or site.Params.render_hooks.link.highlightBroken false }}
{{- /* Validate error level. */}}
{{- if not (in (slice "ignore" "warning" "error") $errorLevel) }}
{{- errorf "The %q render hook is misconfigured. The errorLevel %q is invalid. Please check your site configuration." $renderHookName $errorLevel }}
{{- end }}
{{- /* Determine content path for warning and error messages. */}}
{{- $contentPath := "" }}
{{- with .Page.File }}
{{- $contentPath = .Path }}
{{- else }}
{{- $contentPath = .Path }}
{{- end }}
{{- /* Parse destination. */}}
{{- $u := urls.Parse .Destination }}
{{- /* Set common message. */}}
{{- $msg := printf "The %q render hook was unable to resolve the destination %q in %s" $renderHookName $u.String $contentPath }}
{{- /* Set attributes for anchor element. */}}
{{- $attrs := dict "href" $u.String }}
{{- if $u.IsAbs }}
{{- /* Destination is a remote resource. */}}
{{- $attrs = merge $attrs (dict "rel" "external") }}
{{- else }}
{{- with $u.Path }}
{{- with $p := or ($.Page.GetPage .) ($.Page.GetPage (strings.TrimRight "/" .)) }}
{{- /* Destination is a page. */}}
{{- $href := .RelPermalink }}
{{- with $u.RawQuery }}
{{- $href = printf "%s?%s" $href . }}
{{- end }}
{{- with $u.Fragment }}
{{- $ctx := dict
"contentPath" $contentPath
"errorLevel" $errorLevel
"page" $p
"parsedURL" $u
"renderHookName" $renderHookName
}}
{{- partial "inline/h-rh-l/validate-fragment.html" $ctx }}
{{- $href = printf "%s#%s" $href . }}
{{- end }}
{{- $attrs = dict "href" $href }}
{{- else }}
{{- with $.Page.Resources.Get $u.Path }}
{{- /* Destination is a page resource; drop query and fragment. */}}
{{- $attrs = dict "href" .RelPermalink }}
{{- else }}
{{- with (and (ne $.Page.BundleType "leaf") ($.Page.CurrentSection.Resources.Get $u.Path)) }}
{{- /* Destination is a section resource, and current page is not a leaf bundle. */}}
{{- $attrs = dict "href" .RelPermalink }}
{{- else }}
{{- with resources.Get $u.Path }}
{{- /* Destination is a global resource; drop query and fragment. */}}
{{- $attrs = dict "href" .RelPermalink }}
{{- else }}
{{- if eq $errorLevel "warning" }}
{{- warnf $msg }}
{{- if and $highlightBrokenLinks hugo.IsDevelopment }}
{{- $attrs = merge $attrs (dict "class" "broken") }}
{{- end }}
{{- else if eq $errorLevel "error" }}
{{- errorf $msg }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- else }}
{{- with $u.Fragment }}
{{- /* Destination is on the same page; prepend relative permalink. */}}
{{- $ctx := dict
"contentPath" $contentPath
"errorLevel" $errorLevel
"page" $.Page
"parsedURL" $u
"renderHookName" $renderHookName
}}
{{- partial "inline/h-rh-l/validate-fragment.html" $ctx }}
{{- $attrs = dict "href" (printf "%s#%s" $.Page.RelPermalink .) }}
{{- else }}
{{- if eq $errorLevel "warning" }}
{{- warnf $msg }}
{{- if and $highlightBrokenLinks hugo.IsDevelopment }}
{{- $attrs = merge $attrs (dict "class" "broken") }}
{{- end }}
{{- else if eq $errorLevel "error" }}
{{- errorf $msg }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- with .Title }}
{{- $attrs = merge $attrs (dict "title" .) }}
{{- end -}}
{{- /* Render anchor element. */ -}}
<a
{{- range $k, $v := $attrs }}
{{- printf " %s=%q" $k $v | safeHTMLAttr }}
{{- end -}}
>{{ .Text | safeHTML }}</a>
{{- define "partials/inline/h-rh-l/validate-fragment.html" }}
{{- /*
Validates the fragment portion of a link destination.
@context {string} contentPath The page containing the link.
@context {srting} errorLevel The error level when unable to resolve destination; ignore (default), warning, or error.
@context {page} page The page corresponding to the link destination
@context {struct} parsedURL The link destination parsed by urls.Parse.
@context {string} renderHookName The name of the render hook.
*/}}
{{- /* Initialize. */}}
{{- $contentPath := .contentPath }}
{{- $errorLevel := .errorLevel }}
{{- $p := .page }}
{{- $u := .parsedURL }}
{{- $renderHookName := .renderHookName }}
{{- /* Validate. */}}
{{- with $u.Fragment }}
{{- if $p.Fragments.Identifiers.Contains . }}
{{- if gt ($p.Fragments.Identifiers.Count .) 1 }}
{{- $msg := printf "The %q render hook detected duplicate heading IDs %q in %s" $renderHookName . $contentPath }}
{{- if eq $errorLevel "warning" }}
{{- warnf $msg }}
{{- else if eq $errorLevel "error" }}
{{- errorf $msg }}
{{- end }}
{{- end }}
{{- else }}
{{- /* Determine target path for warning and error message. */}}
{{- $targetPath := "" }}
{{- with $p.File }}
{{- $targetPath = .Path }}
{{- else }}
{{- $targetPath = .Path }}
{{- end }}
{{- /* Set common message. */}}
{{- $msg := printf "The %q render hook was unable to find heading ID %q in %s. See %s" $renderHookName . $targetPath $contentPath }}
{{- if eq $targetPath $contentPath }}
{{- $msg = printf "The %q render hook was unable to find heading ID %q in %s" $renderHookName . $targetPath }}
{{- end }}
{{- /* Throw warning or error. */}}
{{- if eq $errorLevel "warning" }}
{{- warnf $msg }}
{{- else if eq $errorLevel "error" }}
{{- errorf $msg }}
{{- end }}
{{- end }}
{{- end }}
{{- end -}}

View File

@@ -95,7 +95,7 @@
{{- partial "opengraph/twitter_cards.html" . -}}
{{ if hugo.IsProduction }}
{{ partial "gtag" . }}
{{ partial "gtag.html" . }}
{{ end }}
</head>
@@ -104,7 +104,7 @@
class="ma0 sans-serif bg-primary-color-light{{ with getenv "HUGO_ENV" }}
{{ . }}
{{ end }}">
{{ partial "hooks/after-body-start" . }}
{{ partial "hooks/after-body-start.html" . }}
{{ block "nav" . }}{{ partial "site-nav.html" . }}{{ end }}
{{ block "header" . }}{{ end }}
<main role="main" class="content-with-sidebar min-vh-100 pb7 pb0-ns">
@@ -113,7 +113,7 @@
{{ block "footer" . }}{{ partialCached "site-footer.html" . }}{{ end }}
{{ partial "hooks/before-body-end" . }}
{{ partial "hooks/before-body-end.html" . }}
</body>
</html>

View File

@@ -1,23 +1,30 @@
<header class="flex-none w-100">
{{ if .Params.categories }}
{{ range .Params.categories }}
<a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}" class="f6 fw8 mb0 link mid-gray dim mr3">
{{ humanize . | upper }}
{{ if in (slice "functions" "methods") .Type }}
{{ with .FirstSection }}
<a href="{{ .RelPermalink }}" class="f6 fw8 mb0 link mid-gray dim mr3">
{{ humanize .Title | upper }}
</a>
{{ end }}
{{end}}
{{ with .CurrentSection }}
<a href="{{ .RelPermalink }}" class="f6 fw8 mb0 link mid-gray dim mr3">
{{ humanize .Title | upper }}
</a>
{{ end }}
{{ else }}
{{ range .Params.categories }}
<a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}" class="f6 fw8 mb0 link mid-gray dim mr3">
{{ humanize . | upper }}
</a>
{{ end }}
{{ end }}
<h1 class="lh-title mb3 mv0 pt3 primary-color-dark">
{{- if eq .Section "functions" -}}
{{ .LinkTitle }}
{{- else -}}
{{ .Title }}
{{- end -}}
{{ .Title }}
</h1>
</header>
<aside class="bt bw1 pt3 mt2 mid-gray b--mid-gray fn w-100">
{{ with .Params.description }}
<div class="f4 fw4 lh-copy">
<div class="mb4 f4 fw4 lh-copy">
{{ . | markdownify }}
</div>
{{ end }}
@@ -31,7 +38,11 @@
<img src="{{ . }}" alt="Featured Image for {{ $.Title }}" class="mw-100">
{{ end }}
<div class="prose prose-{{ .Type }}" id="prose">
{{- partial "docs/functions-signature.html" . -}}
<div class="prose" id="prose">
<div class="mb4">
{{- partial "docs/functions-signatures.html" . -}}
{{- partial "docs/functions-return-type.html" . -}}
{{- partial "docs/functions-aliases.html" . -}}
</div>
{{ .Content }}
</div>

View File

@@ -2,26 +2,24 @@
<article class="w-100 ph4 pb5 pb6-ns pt1 pt5-ns">
<div class="flex-l">
<div class="order-2 w-100 w-20-l ph5-m ph0-l mb4 sticky">
{{- partial "toc.html" . -}}
<div class="order-0 w-20 dn db-l">
{{ partial "nav-links-docs.html" . }}
</div>
<div class="order-1 w-60-l mw7 ph0 ph5-ns mid-gray nested-copy-line-height no-underline nested-links nested-img nested-copy-seperator nested-blockquote mt0-ns" style="flex-grow:1;">
<div class="documentation-copy center measure-wide-l">
<div id="readout" class="fixed right-0 bottom-0">
</div>
<div class="order-1 flex-grow-1 ph0 ph5-ns mt0-ns mid-gray nested-copy-line-height no-underline nested-links nested-img nested-copy-seperator nested-blockquote">
<div style="max-width: 40rem;" class="documentation-copy">
<div id="readout" class="fixed right-0 bottom-0"></div>
{{ .Render "page" }}
{{ partial "related.html" . }}
</div>
</div>
<div class="order-0 w-20 dn db-l">
{{ partial "nav-links-docs.html" . }}
<div id="right-sidebar" class="order-2 w-20 dn db-l sticky pt2">
{{ partial "right-sidebar.html" . }}
</div>
</div>
</article>
<div class="w-100 bg-light-gray">
<div id="page-footer" class="w-100 bg-light-gray">
<div class="mw7 pa4 center nested-lh-copy lh-copy">
{{ partial "docs/page-meta-data.html" . }}
{{ partial "page-edit.html" . }}

View File

@@ -1,27 +1,27 @@
{{ define "header" }}
{{ partial "hero" . }}
{{ partial "boxes-small-news" . }}
{{ partial "hero.html" . }}
{{ partial "boxes-small-news.html" . }}
{{ end }}
{{ define "main" }}
<section class="w-100 ph4 ph5-ns pv4">
{{- partial "home-page-sections/features-icons" . -}}
{{- partial "home-page-sections/features-icons.html" . -}}
</section>
{{ partial "home-page-sections/sponsors.html" (dict "cx" . "gtag" "home" ) }}
{{- partial "home-page-sections/features-single" . -}}
{{- partial "home-page-sections/features-single.html" . -}}
{{- partial "home-page-sections/showcase.html" . -}}
{{- partial "home-page-sections/showcase.html" . -}}
<section class="w-100 ph4 ph5-ns pv4 pv6-ns mid-gray bg-white bb bt b--light-gray">
{{- partial "home-page-sections/installation" . -}}
{{- partial "home-page-sections/installation.html" . -}}
</section>
<section class="w-100 ph4 ph5-ns pv4 pv6-ns mid-gray bg-accent-color-dark">
{{- partial "home-page-sections/tweets" . -}}
{{- partial "home-page-sections/tweets.html" . -}}
</section>
<section class="w-100 ph4 ph5-ns pt4 pb5 mid-gray bg-primary-color-light bb bt b--light-gray ">
{{- partial "home-page-sections/open-source-involvement" . -}}
{{- partial "home-page-sections/open-source-involvement.html" . -}}
</section>
{{ end }}

View File

@@ -0,0 +1,38 @@
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ .Site.Title }} {{ .Title }}</title>
<link>{{ .Permalink }}</link>
<description>Recent Hugo news from gohugo.io</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
<image>
<url>{{ "img/hugo.png" | absURL }}</url>
<title>GoHugo.io</title>
<link>{{ .Permalink }}</link>
</image>
{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{ range first 50 (where .Site.RegularPages "Type" "in" (slice "news" "showcase")) }}
<item>
<title>{{ .Section | title }}: {{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
<description>
{{ $img := (.Resources.ByType "image").GetMatch "*featured*" }}
{{ with $img }}
{{ $img := .Resize "640x" }}
{{ printf "<![CDATA[<img src=\"%s\" width=\"%d\" height=\"%d\"/>]]>" $img.Permalink $img.Width $img.Height | safeHTML }}
{{ end }}
{{ .Content | html }}
</description>
</item>
{{ end }}
</channel>
</rss>

View File

@@ -0,0 +1,78 @@
{{ define "main" }}
<div class="w-100 ph4 pb5 pb6-ns pt1 mt4 pt3-ns">
<div class="flex-l">
<div class="order-2 w-100 w-20-l ph5-m ph0-l mb4 sticky">
<aside
class="fixed-lTK mw5-l right-0 f6 bl-l b--moon-gray pv4 pv0-ns ph4-l nested-list-reset nested-links nested-copy-line-height">
<p class="b">What's on this Page</p>
<ul>
<li><a href="#last-updated">Last Updated</a></li>
<li>
<a href="#least-recently-updated">Least Recently Updated</a>
</li>
<li><a href="#todos">Pages marked with TODO</a></li>
<li>
<a href="#dependencies">Project dependencies (Hugo Modules)</a>
</li>
</ul>
</aside>
</div>
<div class="w-100">
{{ $byLastMod := .Site.RegularPages.ByLastmod }}
{{ $recent := ($byLastMod | last 30).Reverse }}
{{ $leastRecent := $byLastMod | first 10 }}
<h2 id="last-updated">Last Updated</h2>
{{ partial "maintenance-pages-table.html" $recent }}
<h2 id="least-recently-updated">Least Recently Updated</h2>
{{ partial "maintenance-pages-table.html" $leastRecent }}
{{/* Don't think this is possible with where directly. Should investigate. */}}
{{ .Scratch.Set "todos" slice }}
{{ range .Site.RegularPages }}
{{ if .HasShortcode "todo" }}
{{ $.Scratch.Add "todos" . }}
{{ end }}
{{ end }}
<h2 id="todos">Pages marked with TODO</h2>
{{ partial "maintenance-pages-table.html" (.Scratch.Get "todos") }}
<h2 id="dependencies">Dependencies</h2>
<table class="collapse ba br2 b--black-10 pv2 ph3">
<thead>
<tr>
<th class="pv2 ph3 tl f6 fw6 ttu">#</th>
<th class="pv2 ph3 tl f6 fw6 ttu">Owner</th>
<th class="pv2 ph3 tl f6 fw6 ttu">Path</th>
<th class="pv2 ph3 tl f6 fw6 ttu">Version</th>
<th class="pv2 ph3 tl f6 fw6 ttu">Time</th>
<th class="pv2 ph3 tl f6 fw6 ttu">Vendor</th>
</tr>
</thead>
<tbody>
{{ range $index, $element := hugo.Deps }}
<tr class="striped--light-gray">
<th class="pv2 ph3">{{ add $index 1 }}</th>
<td class="pv2 ph3">
{{ with $element.Owner }}{{ .Path }}{{ end }}
</td>
<td class="pv2 ph3">
{{ $element.Path }}
{{ with $element.Replace }}
=>
{{ .Path }}
{{ end }}
</td>
<td class="pv2 ph3">{{ $element.Version }}</td>
<td class="pv2 ph3">
{{ with $element.Time }}{{ . }}{{ end }}
</td>
<td class="pv2 ph3">{{ $element.Vendor }}</td>
</tr>
{{ end }}
</tbody>
</table>
</div>
</div>
</div>
{{ end }}

View File

@@ -10,32 +10,61 @@
</div>
</article>
<!-- TODO: May be a good idea in this case to add monthly archives -->
<div class="flex flex-wrap">
{{/* [wip] add archive lists
<div class="w-100 w-20-ns dn">
<ul>
<li>
<a href="#">
archive section
</a>
</li>
</ul>
</div> */}}
{{ $interior_classes := $.Site.Params.flex_box_interior_classes }}
<section class="flex-ns flex-wrap justify-between w-100 w-80-nsTK v-top">
{{ $paginator := .Paginate (.Pages | lang.Merge (where .Sites.First.RegularPages "Section" .Section)) -}}
{{ range $paginator.Pages }}
{{ partial "boxes-section-summaries" (dict "context" . "classes" $interior_classes "fullcontent" false) }}
{{ $news_items := slice }}
{{/* Get releases from GitHub. */}}
{{ $u := "https://api.github.com/repos/gohugoio/hugo/releases" }}
{{ $releases := partial "inline/get-remote-data.html" $u }}
{{ $releases = where $releases "draft" false }}
{{ $releases = where $releases "prerelease" false }}
{{ range $releases | first 20 }}
{{ $ctx := dict
"Date" (.published_at | time.AsTime)
"Title" (printf "Release %s" .name)
"Permalink" .html_url
"Section" "news"
"Summary" ""
}}
{{ $news_items = $news_items | append $ctx }}
{{ end }}
{{/* Get content pages from news section. */}}
{{ range .Pages }}
{{ $ctx := dict
"Date" .Date
"Title" .Title
"RelPermalink" .RelPermalink
"Section" "news"
"Summary" .Summary
"Params" (dict "description" .Description)
}}
{{ $news_items = $news_items | append $ctx }}
{{ end }}
{{/* Sort by date (descending) and render. */}}
{{ range sort $news_items "Date" "desc" }}
{{ partial "boxes-section-summaries.html" (dict "context" . "classes" $interior_classes "fullcontent" false) }}
{{ end }}
</section>
</div>
<div class="nested-list-reset nested-links">
{{/* pagination.html: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/template_embedded.go#L117 */}}
{{ template "_internal/pagination.html" . }}
</div>
</div>
{{ end }}
{{ define "partials/inline/get-remote-data.html" }}
{{ $u := . }}
{{ $r := "" }}
{{ with $r = resources.GetRemote $u }}
{{ with .Err }}
{{ errorf "%s" . }}
{{ end }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $u }}
{{ end }}
{{ return ($r | transform.Unmarshal) }}
{{ end }}

View File

@@ -34,9 +34,6 @@
Go to <a href="https://github.com/gohugoio/hugo/releases" class="link primary-color dim">Hugo Releases</a> for the release downloads.
</p>
{{ end }}
<!--
NOTE: Removed to test builds without it.
partial "components/author-github-data" (dict "context" . "size" "110") -->
<div class="nested-links mt4">
{{- partial "previous-next-links-in-section.html" . -}}

View File

@@ -1,35 +1,46 @@
<div class="relative {{ .classes }} weight-{{ .context.Weight }}">
<div class="bg-white mb2 pa3 pa4-l gray">
{{ $href := .context.RelPermalink }}
{{ if eq .context.Section "news" }}
<date class="f6 db" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
{{ $href = .context.Permalink }}
<time class="f6 db" datetime="{{ .context.Date.Format `2006-01-02T15:04:05Z07:00` }}">
{{ .context.Date.Format "January 2, 2006" }}
</date>
</time>
{{ end }}
<h1 class="near-black f3">
<a href="{{ .context.RelPermalink }}" class="link primary-color dim">
{{- if eq .context.Section "functions" -}}
{{ .context.LinkTitle }}
{{- else -}}
<a href="{{ $href }}" class="link primary-color dim">
{{ .context.Title }}
{{- end -}}
</a>
</h1>
<div class="lh-copy links">
{{ if .context.Params.description }}
{{ if eq .context.Section "commands" }}
{{ replaceRE `(?s).*?##\s.*?\n\n(.*?)\n.*` "$1" .context.RawContent }}
{{ else }}
{{ if in (slice "functions" "methods") .context.Type }}
{{ with $signature := index .context.Params.action.signatures 0 }}
{{ if $.context.Params.action.returnType }}
{{ $signature = printf "%s ⟼ %s" $signature $.context.Params.action.returnType }}
{{ end }}
<pre class="f6 mb3 ph3 pv2 bg-light-gray overflow-x-auto">
{{- $signature -}}
</pre>
{{ end }}
{{ end }}
{{ if .context.Params.description }}
{{ .context.Params.description | markdownify }}
{{ else }}
{{ .context.Summary }}
{{ end }}
{{ end }}
<a href="{{ .context.RelPermalink }}" class="f6 mt2 db link primary-color dim">
Read More &raquo;
</a>
<a href="{{ $href }}" class="f6 mt2 db link primary-color dim">
Read More &raquo;
</a>
</div>
</div>
</div>

View File

@@ -1,18 +1 @@
<section class="relative w-100 bg-black white">
<div class="flex flex-wrap w-90-l center center mw9">
<!-- <a href="/news/" class="link accent-color tr-ns f6 w-100 w-50-m w-10-l bg-animate hover-bg-accent-color hover-white pv3 pv4-l ph3 ph4-l dib">
Latest News:
</a> -->
{{ range first 4 ( sort (where .Site.RegularPages "Section" "news") "Date" "desc" ) }}
<!-- only show 2 boxes on mobile -->
{{ $.Scratch.Add "i" 1 }}{{ $i := $.Scratch.Get "i" }}
<a href="{{ .RelPermalink }}" class="link lh-copy light-gray f6 w-100 w-50-m w-25-l bg-animate hover-bg-accent-color hover-white pv3 pv4-ns ph3 ph4-ns{{ if ge $i 3 }} dn dib-l{{ else }} dib{{ end }}">
<span class="f6 gray pb1 db">
{{ .Date.Format "January 2, 2006" }}
</span>
{{ .Params.description | markdownify | truncate 100 "…"}}
</a>
{{ end }}
</div>
</section>
{{/* Empty for now. */}}

View File

@@ -0,0 +1,12 @@
{{- with .Params.action.aliases }}
{{- $label := "Alias" }}
{{- if gt (len .) 1 }}
{{- $label = "Aliases" }}
{{- end }}
<p class="fw7 primary-color-dark">{{ $label }}</p>
{{- range . }}
<pre class="f5 ph3 pv2 bg-light-gray" style="border-left:4px solid #0594CB;">
{{- . -}}
</pre>
{{- end }}
{{- end -}}

View File

@@ -0,0 +1,6 @@
{{- with .Params.action.returnType }}
<p class="fw7 primary-color-dark">Returns</p>
<pre class="f5 ph3 pv2 bg-light-gray" style="border-left:4px solid #0594CB;">
{{- . -}}
</pre>
{{- end -}}

View File

@@ -1,11 +0,0 @@
{{ if isset .Params "signature" -}}
{{- with .Params.signature }}
<h2 class="minor mb1 pt4 primary-color-dark">Syntax</h2>
{{- range . }}
<pre class="f5 mb4 ph3 pv2 bg-light-gray" style="border-left:4px solid #0594CB;">
{{- . -}}
</pre>
{{- end }}
{{- end -}}
{{ end }}
{{/* The inline style overrides `pre` styling defaults */}}

View File

@@ -0,0 +1,12 @@
{{- with .Params.action.signatures }}
<p class="fw7 primary-color-dark">Syntax</p>
{{- range . }}
{{- $signature := . }}
{{- if $.Params.function.returnType }}
{{- $signature = printf "%s ⟼ %s" . $.Params.function.returnType }}
{{- end }}
<pre class="f5 ph3 pv2 bg-light-gray overflow-x-auto" style="border-left:4px solid #0594CB;">
{{- $signature -}}
</pre>
{{- end }}
{{- end -}}

View File

@@ -1,4 +1,4 @@
{{ with .Site.GoogleAnalytics }}
{{ with site.Config.Services.GoogleAnalytics.ID }}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script>
<script>
window.dataLayer = window.dataLayer || [];

View File

@@ -6,6 +6,7 @@
<div class="flex-ns flex-wrap justify-between">
{{ if $.Site.Data.homepagetweets }}
{{ range first 4 (sort $.Site.Data.homepagetweets.tweet "date" "desc" ) }}
<div class="homepage-tweet relative {{ $interior_classes }} br1 mid-gray pv3 nested-links shadow-5">
<div class="absolute top-0 left-0 ma2 o-10">
@@ -21,5 +22,6 @@
</blockquote>
</div>
{{ end }}
{{ end }}
</div>
</div>

View File

@@ -1 +1,7 @@
{{/* Deliberately empty */}}
{{ if .Page.Store.Get "hasMermaid" }}
<script type="module" async>
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@9/+esm';
mermaid.initialize({ startOnLoad: true });
</script>
{{ end }}

View File

@@ -0,0 +1,24 @@
<table class="collapse ba br2 b--black-10 pv2 ph3">
<thead>
<tr>
<th class="pv2 ph3 tl f6 fw6 ttu">LastMod</th>
<th class="pv2 ph3 tl f6 fw6 ttu">Link</th>
<th class="pv2 ph3 tl f6 fw6 ttu">GitHub</th>
</tr>
</thead>
<tbody>
{{ range . }}
<tr class="striped--light-gray">
<td class="pv2 ph3">{{ .Lastmod.Format "2006-01-02" }}</td>
<td class="pv2 ph3">
<a href="{{ .Permalink }}">{{ .Title }}</a>
</td>
<td class="pv2 ph3">
<a href="{{.Site.Params.ghrepo}}blob/master/content/{{.Lang }}/{{.File.Path}}">
{{ with .GitInfo }}{{ .Subject }}{{ else }}Source{{ end }}
</a>
</td>
</tr>
{{ end }}
</tbody>
</table>

View File

@@ -9,8 +9,8 @@
</a>
</div>
{{ partial "nav-links" .}}
{{ partial "nav-links.html" .}}
<div class="dn-l">
{{ partial "nav-button-open" .}}
{{ partial "nav-button-open.html" .}}
</div>
</header>

View File

@@ -39,4 +39,4 @@
{{ end }}{{ end }}
{{- /* Facebook Page Admin ID for Domain Insights */}}
{{- with .Site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
{{- with site.Params.social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}

View File

@@ -17,6 +17,6 @@
{{- end }}
<meta name="twitter:title" content="{{ .Title }}"/>
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
{{ with .Site.Social.twitter -}}
{{ with site.Params.social.twitter -}}
<meta name="twitter:site" content="@{{ . }}"/>
{{ end -}}
{{ end -}}

View File

@@ -16,13 +16,15 @@
</div>
</article>
<!-- TODO: May be a good idea in this case to add monthly archives -->
<div class="flex flex-wrap">
{{ $interior_classes := .context.Site.Params.flex_box_interior_classes }}
<section class="flex-ns flex-wrap justify-between w-100">
{{ range $section_to_display }}
{{ partial "boxes-section-summaries" (dict "context" . "classes" $interior_classes "fullcontent" true) }}
{{ $pages := $section_to_display }}
{{ if in (slice "functions" "methods") $.context.Type }}
{{ $pages = $.context.Pages }}
{{ end }}
{{ range $pages }}
{{ partial "boxes-section-summaries.html" (dict "context" . "classes" $interior_classes "fullcontent" true) }}
{{ end }}
</section>
</div>

View File

@@ -1,9 +1,22 @@
{{ $related := .Site.RegularPages.Related . | first 5 }}
{{ with $related }}
<h2>See Also</h2>
<ul>
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
{{ end }}
{{- $heading := "See also" }}
{{- $related := site.RegularPages.Related . | first 5 }}
{{- if in (slice "functions" "methods") .Type }}
{{- $related = slice }}
{{- range .Params.action.related }}
{{- with site.GetPage (lower .) }}
{{- $related = $related | append . }}
{{- else }}
{{- errorf "The 'related' partial was unable to get page %s" . }}
{{- end }}
{{- end }}
{{- end }}
{{- with $related }}
<h2>{{ $heading }}</h2>
<ul>
{{- range . }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{- end }}
</ul>
{{- end }}

View File

@@ -0,0 +1,29 @@
<aside class="right-0 f6 pv4 pv0-ns ph4-l nested-list-reset nested-copy-line-height">
<div class="nested-links">
{{- partial "previous-next-links-in-section.html" . }}
</div>
{{- /* Table of contents is visible if toc = true in front matter. */}}
{{- if .Params.toc }}
<div class="nested-links">
<p class="f5 fw8 mid-gray mb0">On this page</p>
{{- .TableOfContents }}
</div>
{{- end }}
{{- /* Section menu for single pages is visible if showSectionMenu = true in top level section page. */}}
{{- if .FirstSection.Params.showSectionMenu }}
{{- with .CurrentSection.RegularPages }}
<p class="mb0"><a class="link f5 fw8 mid-gray" href="{{ $.CurrentSection.RelPermalink }}">In this section</a></p>
<nav>
<ul>
{{- range . }}
<li>
<a style="padding: 2px 5px;" class="dib link hover-bg-black-40 hover-white blue nl1" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
</li>
{{- end }}
</ul>
</nav>
{{- end }}
{{- end }}
</aside>

View File

@@ -1,6 +1,6 @@
{{/*
Disable Twitter for now as we lost access to the account.
with .Site.Social.twitter }}
with site.Params.social.twitter }}
<a href="https://twitter.com/intent/follow?screen_name={{ . }}" title="Follow on Twitter" class="link-transition twitter link dib z-999 pt3 pt0-l mr2">
{{ partial "svg/twitter.svg" (dict "size" "32px") }}
</a>

View File

@@ -1,13 +0,0 @@
<!-- TOCs need to be declared explicitly in the front matter of content/*.md -->
<aside class="fixed-lTK mw5-l right-0 f6 bl-l b--moon-gray pv4 pv0-ns ph4-l nested-list-reset nested-links nested-copy-line-height">
{{ if .Params.toc }}
<p class="b">What's on this Page</p>
{{ .TableOfContents }}
{{ end }}
{{- partial "previous-next-links-in-section.html" . -}}
{{- if .Params.godocref -}}
<a target="_blank" class="tooltip right godoc-link" data-tooltip="See the related Godocs for {{.Title }}" href="{{.Params.godocref}}" >
</a>
{{- end -}}
</aside>

View File

@@ -0,0 +1,6 @@
<dl>
{{ range .Site.Data.docs.chroma.lexers }}
<dt>{{ .Name }}</dt>
<dd>{{ with .Aliases }}{{ delimit . ", " }}{{ end }}</dd>
{{ end }}
</dl>

View File

@@ -1,24 +1,101 @@
{{ $langs := (slice "yaml" "toml" "json") }}
<div class="code relative" {{ with .Get "file" }}id="{{ . | urlize}}"{{ end }}>
<div class="code-nav flex flex-nowrap items-stretch">
{{- with .Get "file" -}}
<div class="san-serif f6 dib lh-solid pl2 pv2 mr2">{{ . }}.</div>
{{- end -}}
{{ range $langs }}
<button data-toggle-tab="{{ . }}" class="tab-button {{ cond (eq . "yaml") "active" ""}} ba san-serif f6 dib lh-solid ph2 pv2">{{ . }}</button>&nbsp;
{{ end }}
</div>
<div class="tab-content">
{{ range $langs }}
<div data-pane="{{ . }}" class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" ""}}">
{{ highlight ($.Inner | transform.Remarshal . | safeHTML) . ""}}
</div>
{{ if ne ($.Get "copy") "false" }}
<button class="needs-js copy copy-toggle bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button">
</button>
{{/* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
{{end}}
{{ end }}
</div>
{{- /*
Renders syntax-highlighted configuration data in JSON, TOML, and YAML formats.
@param {string} [config] The section of site.Data.docs.config to render.
@param {bool} [copy=false] If true, display a copy to clipboard button.
@param {string} [file] The file name to display above the rendered code.
@param {bool} [fm=false] If true, render the code as front matter.
@param {bool} [skipHeader=false] If false, omit top level key(s) when rendering a section of site.Data.docs.config.
@returns {template.HTML}
*/}}
{{- /* Initialize. */}}
{{- $config := "" }}
{{- $dataKey := "" }}
{{- $copy := false }}
{{- $file := "" }}
{{- $fm := false }}
{{- $skipHeader := false }}
{{- /* Get parameters. */}}
{{- $config = .Get "config" }}
{{- $dataKey = .Get "dataKey" }}
{{- $file = .Get "file" }}
{{- if in (slice "false" false 0) (.Get "copy") }}
{{- $copy = false }}
{{- else if in (slice "true" true 1) (.Get "copy") }}
{{- $copy = true }}
{{- end }}
{{- if in (slice "false" false 0) (.Get "fm") }}
{{- $fm = false }}
{{- else if in (slice "true" true 1) (.Get "fm") }}
{{- $fm = true }}
{{- end }}
{{- if in (slice "false" false 0) (.Get "skipHeader") }}
{{- $skipHeader = false }}
{{- else if in (slice "true" true 1) (.Get "skipHeader") }}
{{- $skipHeader = true }}
{{- end }}
{{- /* Define constants. */}}
{{- $delimiters := dict "toml" "+++" "yaml" "---" }}
{{- $langs := slice "yaml" "toml" "json" }}
{{- $placeHolder := "#-hugo-placeholder-#" }}
{{- /* Render. */}}
{{- $code := "" }}
{{- if $config }}
{{- $file = $file | default "hugo" }}
{{- $sections := (split $config ".") }}
{{- $configSection := index $.Site.Data.docs.config $sections }}
{{- $code = dict $sections $configSection }}
{{- if $skipHeader }}
{{- $code = $configSection }}
{{- end }}
{{- else if $dataKey }}
{{- $file = $file | default $dataKey }}
{{- $sections := (split $dataKey ".") }}
{{- $code = index $.Site.Data.docs $sections }}
{{- else }}
{{- $code = $.Inner }}
{{- end }}
<div class="code relative" {{ with $file }}id="{{ . | urlize }}"{{ end }}>
<div class="code-nav flex flex-nowrap items-stretch">
{{- with $file }}
<div class="san-serif f6 dib lh-solid pl2 pv2 mr2">
{{ . }}{{ if not $fm }}.{{ end }}
</div>
{{- end }}
{{- range $langs }}
<button
data-toggle-tab="{{ . }}"
class="tab-button {{ cond (eq . "yaml") "active" "" }} ba san-serif f6 dib lh-solid ph2 pv2">
{{ . }}
</button>
&nbsp;
{{- end }}
</div>
<div class="tab-content">
{{- range $langs }}
<div
data-pane="{{ . }}"
class="code-copy-content nt3 tab-pane {{ cond (eq . "yaml") "active" "" }}">
{{- $hCode := $code | transform.Remarshal . }}
{{- if and $fm (in (slice "toml" "yaml") .) }}
{{- $hCode = printf "%s\n%s\n%s" $placeHolder $hCode $placeHolder }}
{{- end }}
{{- $hCode = $hCode | replaceRE `\n+` "\n" }}
{{ highlight $hCode . "" | replaceRE $placeHolder (index $delimiters .) | safeHTML }}
</div>
{{- if $copy }}
<button
class="needs-js copy copy-toggle bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2"
title="Copy this code to your clipboard."
data-clipboard-action="copy"
aria-label="copy button"></button>
{{- /* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
{{- end }}
{{- end }}
</div>
</div>

View File

@@ -1,15 +1,35 @@
<div class="code relative bg-primary-color moon-gray" id="{{.Get "file" | urlize}}">
{{- with .Get "file" -}}
<div class="filename san-serif f6 dib lh-solid pl2 pv2">{{.}}</div>
{{- end -}}
{{- /*
Renders syntax highlighted code.
{{ if ne (.Get "copy") "false" }}
<button class="needs-js copy bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button">
</button>
{{/* Functionality located within filesaver.js The copy here is located in the css with .copy class so it can be replaced with JS on success */}}
{{end}}
<div class="code-copy-content nt3" {{with .Get "download"}}id="{{.}}"{{end}}>
{{- .Inner -}}
</div>
@param {bool} [copy=false] If true, display a copy to clipboard button.
@param {string} [file] The file name to display above the rendered code.
@param {string} [lang] The code language of the inner content.
@returns {template.HTML}
*/}}
{{- /* Get parameters. */}}
{{- $copy := false }}
{{- if in (slice "false" false 0) (.Get "copy") }}
{{- $copy = false }}
{{- else if in (slice "true" true 1) (.Get "copy")}}
{{- $copy = true }}
{{- end }}
{{- $file := or (.Get "file") "&nbsp;" }}
{{- $lang := or (.Get "lang") (path.Ext $file | strings.TrimPrefix ".") "text" }}
{{- /* Use the go-html-template Chroma lexer for HTML. */}}
{{- if eq $lang "html" }}
{{- $lang = "go-html-template" }}
{{- end }}
{{- /* Render. */}}
<div class="code relative" id="{{ $file | urlize }}">
<div class="f6 dib lh-solid pl2 pv2">{{ $file | htmlUnescape }}</div>
{{- if $copy }}
<button class="needs-js copy bg-accent-color-dark f6 absolute top-0 right-0 lh-solid hover-bg-primary-color-dark bn white ph3 pv2" title="Copy this code to your clipboard." data-clipboard-action="copy" aria-label="copy button"></button>
{{- end }}
<div class="code-copy-content nt3">
{{- highlight (trim .Inner "\n\r") $lang }}
</div>
</div>

View File

@@ -0,0 +1,39 @@
{{ $package := (index .Params 0) }}
{{ $listname := (index .Params 1) }}
{{ $filter := split (index .Params 2) " " }}
{{ $filter1 := index $filter 0 }}
{{ $filter2 := index $filter 1 }}
{{ $filter3 := index $filter 2 }}
{{ $list := (index (index .Site.Data.docs $package) $listname) }}
{{ $fields := after 3 .Params }}
{{ $list := where $list $filter1 $filter2 $filter3 }}
<table class="table table-bordered">
<tr>
{{ range $fields }}
<th>{{ . }}</th>
{{ end }}
</tr>
{{ range $list }}
<tr>
{{ range $k, $v := . }}
{{ $.Scratch.Set $k $v }}
{{ end }}
{{ range $k, $v := $fields }}
<td>
{{ $tdContent := $.Scratch.Get . }}
{{ if eq $k 3 }}
{{ printf "%v" $tdContent |
strings.ReplaceRE `\[` "<ol><li>" |
strings.ReplaceRE `\s` "</li><li>" |
strings.ReplaceRE `\]` "</li></ol>" |
safeHTML }}
{{ else }}
{{ $tdContent }}
{{ end}}
</td>
{{ end }}
</tr>
{{ end }}
</table>

View File

@@ -1,18 +1,33 @@
<table class="utils-table">
<thead>
<tr>
<td class="col-title">Title</td>
<td class="col-author">Author</td>
<td class="col-date">Date</td>
</tr>
</thead>
<tbody>
{{ range $ind, $art := $.Site.Data.articles.article }}
<tr>
<td><a href="{{$art.url}}" target="_blank">{{$art.title | markdownify }}</a></td>
<td>{{ $art.author | markdownify }}</td>
<td>{{ $art.date }}</td>
</tr>
{{ end }}
</tbody>
</table>
{{ $package := (index .Params 0) }}
{{ $listname := (index .Params 1) }}
{{ $list := (index (index .Site.Data.docs $package) $listname) }}
{{ $fields := after 2 .Params }}
<table class="table table-bordered">
<tr>
{{ range $fields }}
{{ $s := . }}
{{ if eq $s "_key" }}
{{ $s = "Type" }}
{{ end }}
<th>{{ $s }}</th>
{{ end }}
</tr>
{{ range $k1, $v1 := $list }}
<tr>
{{ range $k2, $v2 := . }}
{{ $.Scratch.Set $k2 $v2 }}
{{ end }}
{{ range $fields }}
{{ $s := "" }}
{{ if eq . "_key" }}
{{ $s = $k1 }}
{{ else }}
{{ $s = $.Scratch.Get . }}
{{ end }}
<td>{{ $s }}</td>
{{ end }}
</tr>
{{ end }}
</table>

View File

@@ -0,0 +1,14 @@
{{ $_hugo_config := `{ "version": 1 }` }}
{{ with .Get 0 }}
{{ $version := printf "v%v" (strings.TrimLeft "vV" .) }}
{{ $href := printf "https://github.com/gohugoio/hugo/releases/tag/%s" $version }}
<aside>
<div class="admonition-content bl bw2 b--dark-red" >
<p>Deprecated in <a href="{{ $href }}">{{ $version }}</a></p>
{{ $.Inner }}
</div>
</aside>
{{ else }}
{{ errorf "The %q shortcode requires a single positional parameter indicating version. See %s" .Name .Position }}
{{ end }}

View File

@@ -1,13 +0,0 @@
{{- $pathURL := .Get "pathURL" -}}
{{- $path := .Get "path" -}}
{{- $files := readDir $path -}}
<table>
<th>Size in bytes</th>
<th>Name</th>
{{- range $files }}
<tr>
<td>{{ .Size }}</td>
<td><a href="{{ $pathURL }}{{ .Name | relURL }}" target="_blank"> {{ .Name }}</a></td>
</tr>
{{- end }}
</table>

View File

@@ -1,11 +0,0 @@
{{ $file := .Get 0}}
{{ $filepath := $file }}
{{ $syntax := index (split $file ".") 1 }}
{{ $syntaxoverride := eq (len .Params) 2 }}
<div class="code-copy" id="{{$file | urlize}}">
<div class="code-copy-header"><div class="action-buttons"></div><span title="" class="filename">{{$filepath}}</span><i class="icon-{{$syntax}} input"></i></div>
<button class="copy-button" title="Copy to clipboard" data-clipboard-snippet>
<div class="copy-text"><i class="icon-clipboard"></i> COPY</div>
</button>
<pre><code class="language-{{if $syntaxoverride}}{{.Get 1}}{{else}}{{$syntax}}{{end}}">{{- readFile $file -}}</code></pre>
</div>

View File

@@ -1,12 +0,0 @@
{{ $file := .Get 0}}
{{ $filepath := replace $file "static/" ""}}
{{ $syntax := index (split $file ".") 1 }}
{{ $syntaxoverride := eq (len .Params) 2 }}
<div class="code-copy" id="{{$file | urlize}}">
<div class="code-copy-header examplesite"><div class="action-buttons"></div><span class="filename"><i class="icon-website"></i>{{$filepath}}</span><i class="icon-{{$syntax}} input"></i></div>
<button class="copy-button" title="Copy to clipboard" data-clipboard-snippet>
<div class="copy-text"><i class="icon-clipboard"></i> COPY</div>
</button>
<pre><code class="language-{{if $syntaxoverride}}{{.Get 1}}{{else}}{{$syntax}}{{end}}">{{- readFile $file -}}</code></pre>
<a role="button" target="_blank" href="{{$.Site.Params.ghdocsrepo}}{{$file}}" title="See {{$filepath}} source on GitHub" class="tooltip see-on-github" data-tooltip="See {{$filepath}} source on GitHub">Source<i class="icon-github"></i></a>
</div>

View File

@@ -1,13 +0,0 @@
<!-- Similar to exfile.html but *only* pulls the front matter from the example/content/*md -->
{{ $file := .Get 0}}
{{ $filepath := replace $file "static/" ""}}
{{ $syntax := index (split $file ".") 1 }}
{{ $syntaxoverride := eq (len .Params) 2 }}
<div class="code-copy" id="{{$file | urlize}}">
<div class="code-copy-header examplesite"><div class="action-buttons"></div><span title="" class="filename">{{$filepath}}</span><i class="icon-{{$syntax}} input"></i></div>
<button class="copy-button" title="Copy to clipboard" data-clipboard-snippet>
<div class="copy-text"><i class="icon-clipboard"></i> COPY</div>
</button>
<pre><code class="language-{{if $syntaxoverride}}{{.Get 1}}{{else}}{{$syntax}}{{end}}">{{- readFile $file -}}</code></pre>
<a role="button" target="_blank" href="{{$.Site.Params.ghdocsrepo}}{{$file}}" title="See {{$filepath}} on GitHub" class="see-on-github">Source<i class="icon-github"></i></a>
</div>

View File

@@ -0,0 +1,4 @@
<h4 class="minor mb1 pt2 primary-color-dark">Syntax</h4>
<pre class="f5 mb4 ph3 pv2 bg-light-gray overflow-x-auto" style="border-left:4px solid #0594CB;">
{{- .Inner -}}
</pre>

View File

@@ -1,9 +0,0 @@
{{ range .Params }}
{{ if eq (substr . 0 1) "@" }}
<a href="//github.com/{{ substr . 1 }}">{{ . }}</a>
{{ else if eq (substr . 0 2) "0x" }}
<a href="//github.com/gohugoio/hugo/commit/{{ substr . 2 }}">{{ substr . 2 6 }}</a>
{{ else }}
<a href="//github.com/gohugoio/hugo/issues/{{ . }}">#{{ . }}</a>
{{ end }}
{{ end }}

View File

@@ -1 +0,0 @@
<a href="{{$.Site.Params.ghrepo}}" target="_blank">GitHub repository</a>

View File

@@ -0,0 +1,17 @@
{{ $text := `
Most of the commands for **Hugo Modules** require a newer version of Go installed (see https://golang.org/dl/) and the relevant VCS client (e.g. Git, see https://git-scm.com/downloads/ ). If you have an "older" site running on Netlify, you may have to set GO_VERSION to 1.12 in your Environment settings.
For more information about Go Modules, see:
* https://github.com/golang/go/wiki/Modules
* https://blog.golang.org/using-go-modules
` }}
<aside class="admonition note">
<div class="note-icon">
{{partial "svg/exclamation.svg" (dict "size" "20px" ) }}
</div>
<div class="admonition-content">
{{- $text | markdownify -}}
</div>
</aside>

View File

@@ -0,0 +1,374 @@
{{- /*
Renders the given image using the given filter, if any.
@param {string} src The path to the image which must be a remote, page, or global resource.
@param {string} [filter] The filter to apply to the image (case-insensitive).
@param {string} [filterArgs] A comma-delimited list of arguments to pass to the filter.
@param {bool} [example=false] If true, renders a before/after example.
@param {int} [exampleWidth=384] Image width, in pixels, when rendering a before/after example.
@returns {template.HTML}
@examples
{{< img src="zion-national-park.jpg" >}}
{{< img src="zion-national-park.jpg" alt="Zion National Park" >}}
{{< img
src="zion-national-park.jpg"
alt="Zion National Park"
filter="grayscale"
>}}
{{< img
src="zion-national-park.jpg"
alt="Zion National Park"
filter="process"
filterArgs="resize 400x webp"
>}}
{{< img
src="zion-national-park.jpg"
alt="Zion National Park"
filter="colorize"
filterArgs="180,50,20"
>}}
{{< img
src="zion-national-park.jpg"
alt="Zion National Park"
filter="grayscale"
example=true
>}}
{{< img
src="zion-national-park.jpg"
alt="Zion National Park"
filter="grayscale"
example=true
exampleWidth=400
>}}
When using the text filter, provide the arguments in this order:
0. The text
1. The horizontal offset, in pixels, relative to the left of the image (default 20)
2. The vertical offset, in pixels, relative to the top of the image (default 20)
3. The font size in pixels (default 64)
4. The line height (default 1.2)
5. The font color (default #ffffff)
{{< img
src="images/examples/zion-national-park.jpg"
alt="Zion National Park"
filter="Text"
filterArgs="Zion National Park,25,250,56"
example=true
>}}
When using the padding filter, provide all arguments in this order:
0. Padding top
1. Padding right
2. Padding bottom
3. Padding right
4. Canvas color
{{< img
src="images/examples/zion-national-park.jpg"
alt="Zion National Park"
filter="Padding"
filterArgs="20,50,20,50,#0705"
example=true
>}}
*/}}
{{- /* Initialize. */}}
{{- $alt := "" }}
{{- $src := "" }}
{{- $filter := "" }}
{{- $filterArgs := slice }}
{{- $example := false }}
{{- $exampleWidth := 384 }}
{{- /* Default values to use with the text filter. */}}
{{ $textFilterOpts := dict
"xOffset" 20
"yOffset" 20
"fontSize" 64
"lineHeight" 1.2
"fontColor" "#ffffff"
"fontPath" "https://github.com/google/fonts/raw/main/apache/roboto/static/Roboto-Regular.ttf"
}}
{{- /* Get and validate parameters. */}}
{{- with .Get "alt" }}
{{- $alt = .}}
{{- end }}
{{- with .Get "src" }}
{{- $src = . }}
{{- else }}
{{- errorf "The %q shortcode requires a file parameter. See %s" .Name .Position }}
{{- end }}
{{- with .Get "filter" }}
{{- $filter = . | lower }}
{{- end }}
{{- $validFilters := slice
"brightness" "colorbalance" "colorize" "contrast" "gamma" "gaussianblur"
"grayscale" "hue" "invert" "none" "opacity" "overlay" "padding" "pixelate"
"process" "saturation" "sepia" "sigmoid" "text" "unsharpmask"
}}
{{- with $filter }}
{{- if not (in $validFilters .) }}
{{- errorf "The filter passed to the %q shortcode is invalid. The filter must be one of %s. See %s" $.Name (delimit $validFilters ", " ", or ") $.Position }}
{{- end }}
{{- end }}
{{- with .Get "filterArgs" }}
{{- $filterArgs = split . "," }}
{{- $filterArgs = apply $filterArgs "trim" "." " " }}
{{- end }}
{{- if in (slice "false" false 0) (.Get "example") }}
{{- $example = false }}
{{- else if in (slice "true" true 1) (.Get "example")}}
{{- $example = true }}
{{- end }}
{{- with .Get "exampleWidth" }}
{{- $exampleWidth = . | int }}
{{- end }}
{{- /* Get image. */}}
{{- $ctx := dict "page" .Page "src" $src "name" .Name "position" .Position }}
{{- $i := partial "inline/get-resource.html" $ctx }}
{{- /* Resize if rendering before/after examples. */}}
{{- if $example }}
{{- $i = $i.Resize (printf "%dx" $exampleWidth) }}
{{- end }}
{{- /* Create filter. */}}
{{- $f := "" }}
{{- $ctx := dict "filter" $filter "args" $filterArgs "name" .Name "position" .Position }}
{{- if eq $filter "brightness" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 0) "min" -100 "max" 100) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Brightness (index $filterArgs 0) }}
{{- else if eq $filter "colorbalance" }}
{{- $ctx = merge $ctx (dict "argsRequired" 3) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "percentage red" "argValue" (index $filterArgs 0) "min" -100 "max" 500) }}
{{- template "validate-arg-value" $ctx }}
{{- $ctx = merge $ctx (dict "argName" "percentage green" "argValue" (index $filterArgs 1) "min" -100 "max" 500) }}
{{- template "validate-arg-value" $ctx }}
{{- $ctx = merge $ctx (dict "argName" "percentage blue" "argValue" (index $filterArgs 2) "min" -100 "max" 500) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.ColorBalance (index $filterArgs 0) (index $filterArgs 1) (index $filterArgs 2) }}
{{- else if eq $filter "colorize" }}
{{- $ctx = merge $ctx (dict "argsRequired" 3) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "hue" "argValue" (index $filterArgs 0) "min" 0 "max" 360) }}
{{- template "validate-arg-value" $ctx }}
{{- $ctx = merge $ctx (dict "argName" "saturation" "argValue" (index $filterArgs 1) "min" 0 "max" 100) }}
{{- template "validate-arg-value" $ctx }}
{{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 2) "min" 0 "max" 100) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Colorize (index $filterArgs 0) (index $filterArgs 1) (index $filterArgs 2) }}
{{- else if eq $filter "contrast" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 0) "min" -100 "max" 100) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Contrast (index $filterArgs 0) }}
{{- else if eq $filter "gamma" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "gamma" "argValue" (index $filterArgs 0) "min" 0 "max" 100) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Gamma (index $filterArgs 0) }}
{{- else if eq $filter "gaussianblur" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "sigma" "argValue" (index $filterArgs 0) "min" 0 "max" 1000) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.GaussianBlur (index $filterArgs 0) }}
{{- else if eq $filter "grayscale" }}
{{- $ctx = merge $ctx (dict "argsRequired" 0) }}
{{- template "validate-arg-count" $ctx }}
{{- $f = images.Grayscale }}
{{- else if eq $filter "hue" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "shift" "argValue" (index $filterArgs 0) "min" -180 "max" 180) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Hue (index $filterArgs 0) }}
{{- else if eq $filter "invert" }}
{{- $ctx = merge $ctx (dict "argsRequired" 0) }}
{{- template "validate-arg-count" $ctx }}
{{- $f = images.Invert }}
{{- else if eq $filter "opacity" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "opacity" "argValue" (index $filterArgs 0) "min" 0 "max" 1) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Opacity (index $filterArgs 0) }}
{{- else if eq $filter "overlay" }}
{{- $ctx = merge $ctx (dict "argsRequired" 3) }}
{{- template "validate-arg-count" $ctx }}
{{- $ctx := dict "src" (index $filterArgs 0) "name" .Name "position" .Position }}
{{- $overlayImg := partial "inline/get-resource.html" $ctx }}
{{- $f = images.Overlay $overlayImg (index $filterArgs 1 | float ) (index $filterArgs 2 | float) }}
{{- else if eq $filter "padding" }}
{{- $ctx = merge $ctx (dict "argsRequired" 5) }}
{{- template "validate-arg-count" $ctx }}
{{- $f = images.Padding
(index $filterArgs 0 | int)
(index $filterArgs 1 | int)
(index $filterArgs 2 | int)
(index $filterArgs 3 | int)
(index $filterArgs 4)
}}
{{- else if eq $filter "pixelate" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "size" "argValue" (index $filterArgs 0) "min" 0 "max" 1000) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Pixelate (index $filterArgs 0) }}
{{- else if eq $filter "process" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $f = images.Process (index $filterArgs 0) }}
{{- else if eq $filter "saturation" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 0) "min" -100 "max" 500) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Saturation (index $filterArgs 0) }}
{{- else if eq $filter "sepia" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "percentage" "argValue" (index $filterArgs 0) "min" 0 "max" 100) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Sepia (index $filterArgs 0) }}
{{- else if eq $filter "sigmoid" }}
{{- $ctx = merge $ctx (dict "argsRequired" 2) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "midpoint" "argValue" (index $filterArgs 0) "min" 0 "max" 1) }}
{{- template "validate-arg-value" $ctx }}
{{- $ctx = merge $ctx (dict "argName" "factor" "argValue" (index $filterArgs 1) "min" -10 "max" 10) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.Sigmoid (index $filterArgs 0) (index $filterArgs 1) }}
{{- else if eq $filter "text" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $ctx := dict "src" $textFilterOpts.fontPath "name" .Name "position" .Position }}
{{- $font := or (partial "inline/get-resource.html" $ctx) }}
{{- $fontSize := or (index $filterArgs 3 | int) $textFilterOpts.fontSize }}
{{- $lineHeight := math.Max (or (index $filterArgs 4 | float) $textFilterOpts.lineHeight) 1 }}
{{- $opts := dict
"x" (or (index $filterArgs 1 | int) $textFilterOpts.xOffset)
"y" (or (index $filterArgs 2 | int) $textFilterOpts.yOffset)
"size" $fontSize
"linespacing" (mul (sub $lineHeight 1) $fontSize)
"color" (or (index $filterArgs 5) $textFilterOpts.fontColor)
"font" $font
}}
{{- $f = images.Text (index $filterArgs 0) $opts }}
{{- else if eq $filter "unsharpmask" }}
{{- $ctx = merge $ctx (dict "argsRequired" 3) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}
{{- $ctx = merge $ctx (dict "argName" "sigma" "argValue" (index $filterArgs 0) "min" 0 "max" 500) }}
{{- template "validate-arg-value" $ctx }}
{{- $ctx = merge $ctx (dict "argName" "amount" "argValue" (index $filterArgs 1) "min" 0 "max" 100) }}
{{- template "validate-arg-value" $ctx }}
{{- $ctx = merge $ctx (dict "argName" "threshold" "argValue" (index $filterArgs 2) "min" 0 "max" 1) }}
{{- template "validate-arg-value" $ctx }}
{{- $f = images.UnsharpMask (index $filterArgs 0) (index $filterArgs 1) (index $filterArgs 2) }}
{{- end }}
{{- /* Apply filter. */}}
{{- $fi := $i }}
{{- with $f }}
{{- $fi = $i.Filter . }}
{{- end }}
{{- /* Render. */}}
{{- if $example }}
<p>Original</p>
<img class='di ba b--black-20' style="width: initial;" src="{{ $i.RelPermalink }}" alt="{{ $alt }}">
<p>Processed</p>
<img class='di ba b--black-20' style="width: initial;" src="{{ $fi.RelPermalink }}" alt="{{ $alt }}">
{{- else -}}
<img class='di' style="width: initial;" src="{{ $fi.RelPermalink }}" alt="{{ $alt }}">
{{- end }}
{{- define "validate-arg-count" }}
{{- $msg := "When using the %q filter, the %q shortcode requires an args parameter with %d %s. See %s" }}
{{- if lt (len .args) .argsRequired }}
{{- $text := "values" }}
{{- if eq 1 .argsRequired }}
{{- $text = "value" }}
{{- end }}
{{- errorf $msg .filter .name .argsRequired $text .position }}
{{- end }}
{{- end }}
{{- define "validate-arg-value" }}
{{- $msg := "The %q argument passed to the %q shortcode is invalid. Expected a value in the range [%v,%v], but received %v. See %s" }}
{{- if or (lt .argValue .min) (gt .argValue .max) }}
{{- errorf $msg .argName .name .min .max .argValue .position }}
{{- end }}
{{- end }}
{{- define "partials/inline/get-resource.html" }}
{{- $r := "" }}
{{- $u := urls.Parse .src }}
{{- $msg := "The %q shortcode was unable to resolve %s. See %s" }}
{{- if $u.IsAbs }}
{{- with resources.GetRemote $u.String }}
{{- with .Err }}
{{- errorf "%s" }}
{{- else }}
{{- /* This is a remote resource. */}}
{{- $r = . }}
{{- end }}
{{- else }}
{{- errorf $msg $.name $u.String $.position }}
{{- end }}
{{- else }}
{{- with .page.Resources.Get (strings.TrimPrefix "./" $u.Path) }}
{{- /* This is a page resource. */}}
{{- $r = . }}
{{- else }}
{{- with resources.Get $u.Path }}
{{- /* This is a global resource. */}}
{{- $r = . }}
{{- else }}
{{- errorf $msg $.name $u.Path $.position }}
{{- end }}
{{- end }}
{{- end }}
{{- return $r}}
{{- end -}}

View File

@@ -0,0 +1,37 @@
{{- /*
Renders the given image using the given process specification.
@param {string} (positional parameter 0) The path to the image, relative to the current page. The image must be a page resource.
@param {string}} (positional parameter 1) The image processing specification.
@returns template.HTML
@example {{< imgproc "sunset.jpg" "resize 300x" />}}
*/}}
{{- with $.Get 0 }}
{{- with $i := $.Page.Resources.Get . }}
{{- with $spec := $.Get 1 }}
{{- with $i.Process . }}
<figure style="padding: 0.25rem; margin: 2rem 0; background-color: #cccc">
<img style="max-width: 100%; width: auto; height: auto;" src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
<figcaption>
<small>
{{- with $.Inner }}
{{ . }}
{{- else }}
{{ $spec }}
{{- end }}
</small>
</figcaption>
</figure>
{{- end }}
{{- else }}
{{- errorf "The %q shortcode requires a positional parameter (1) containing the image processing specification. See %s" $.Name $.Position }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode requires a positional parameter (0) indicating the image path, relative to the current page. See %s" $.Name $.Position }}
{{- end }}

View File

@@ -0,0 +1,20 @@
{{- /*
Renders the page using the RenderShortcode method on the Page object.
You must call this shortcode using the {{% %}} notation.
@param {string} (postional parameter 0) The path to the page, relative to the content directory.
@returns template.HTML
@example {{% include "functions/_common/glob-patterns" %}}
*/}}
{{- with .Get 0 }}
{{- with site.GetPage . }}
{{- .RenderShortcodes }}
{{- else }}
{{- errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode requires a positional parameter indicating the path of the file to include. See %s" .Name .Position }}
{{- end }}

View File

@@ -0,0 +1,96 @@
{{- /*
Renders a desciption list of the pages in the given section.
Render a subset of the pages in the section by specifying a predefined filter,
and whether to include those pages.
Filters are defined in the data directory, in the file named page_filters. Each
filter is an array of paths to a file, relative to the root of the content
directory. Hugo will throw an error if the specified filter does not exist, or
if any of the pages in the filter do not exist.
The definition term elements (dt) have an id attribute derived from the title
of the page. This is probably unique, because pages of the same title in the
same section is unlikely.
If you render a complete list on a page, then call the shortcode again to
render a subset, you will generate duplicate element ids. In this case, set
omitElementIDs to true for the subset.
@param {string} path The path to the section.
@param {string} [filter=""] The name of filter list.
@param {string} [filterType=""] The type of filter, either include or exclude.
@param {string} [omitElementIDs=false] Whether to omit dt element ids.
@param {string} [titlePrefix=""] The string to prepend to the link title.
@returns template.HTML
@example {{< list-pages-in-section path=/methods/resources >}}
@example {{< list-pages-in-section path=/functions/images filter=some_filter filterType=exclude >}}
@example {{< list-pages-in-section path=/functions/images filter=some_filter filterType=exclude titlePrefix=foo >}}
@example {{< list-pages-in-section path=/functions/images filter=some_filter filterType=exclude titlePrefix=foo omitElementIDs=true >}}
*/}}
{{- /* Initialize. */}}
{{- $filter := or "" (.Get "filter" | lower)}}
{{- $filterType := or (.Get "filterType") "none" | lower }}
{{- $filteredPages := slice }}
{{- $titlePrefix := or (.Get "titlePrefix") "" }}
{{- $omitElementIDs := false }}
{{- /* Get boolean parameters. */}}
{{- if in (slice "false" false 0) (.Get "omitElementIDs") }}
{{- $omitElementIDs = false }}
{{- else if in (slice "true" true 1) (.Get "omitElementIDs")}}
{{- $omitElementIDs = true }}
{{- end }}
{{- /* Build slice of filtered pages. */}}
{{- with $filter }}
{{- with index site.Data.page_filters . }}
{{- range . }}
{{- with site.GetPage . }}
{{- $filteredPages = $filteredPages | append . }}
{{- else }}
{{- errorf "The %q shortcode was unable to find %q as specified in the page_filters data file. See %s" $.Name . $.Position }}
{{- end }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode was unable to find the %q filter in the page_filters data file. See %s" $.Name . $.Position }}
{{- end }}
{{- end }}
{{- /* Render */}}
{{- with $sectionPath := .Get "path" }}
{{- with site.GetPage . }}
{{- with .RegularPages }}
<dl>
{{- range $page := .ByTitle }}
{{- if or
(and (eq $filterType "include") (in $filteredPages $page))
(and (eq $filterType "exclude") (not (in $filteredPages $page)))
(eq $filterType "none")
}}
{{- $linkTitle := .LinkTitle }}
{{- with $titlePrefix }}
{{- $linkTitle = printf "%s%s" . $linkTitle }}
{{- end }}
{{- $idAttribute := "" }}
{{- if not $omitElementIDs }}
{{- $id := path.Join .File.Dir .File.ContentBaseName | replaceRE `[\|/]` ":" | lower }}
{{- $idAttribute = printf " id=%q" $id }}
{{- end }}
<dt {{- $idAttribute | safeHTMLAttr }}><a href="{{ $page.RelPermalink }}">{{ $linkTitle }}</a></dt>
<dd>{{- $page.Description | $page.RenderString }}</dd>
{{- end }}
{{- end }}
</dl>
{{- else }}
{{- warnf "The %q shortcode found no pages in the %q section. See %s" $.Name $sectionPath $.Position }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode was unable to find %q. See %s" $.Name $sectionPath $.Position }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode requires a 'path' parameter indicating the path to the section. See %s" $.Name $.Position }}
{{- end }}

View File

@@ -0,0 +1 @@
Also see [Module Mounts Config](/hugo-modules/configuration/#module-configuration-mounts) for an alternative way to configure this directory (from Hugo 0.56).

View File

@@ -0,0 +1,13 @@
{{ $version := .Get 0 }}
{{ if not $version }}
{{ errorf "Missing version in new-in shortcode " }}
{{ end }}
{{ $version = $version | strings.TrimPrefix "v" }}
<button
class="bg-white hover:bg-gray-100 text-gray-800 font-semibold py-2 mr2 px-4 border border-gray-400 rounded shadow">
<a
href="{{ printf "https://github.com/gohugoio/hugo/releases/tag/v%s" $version }}"
target="_blank"
>New in v{{ $version }}</a
>
</button>

View File

@@ -1 +0,0 @@
<pre><code class="nohighlight">{{ .Inner }}</code></pre>

View File

@@ -1,9 +1,7 @@
{{ $_hugo_config := `{ "version": 1 }` }}
<aside class="admonition note">
<div class="note-icon">
{{partial "svg/exclamation.svg" (dict "size" "20px" ) }}
</div>
<!-- <h2 id="{{if .Get 0}}{{.Get 0 | urlize}}{{else}}note{{end}}">{{if .Get 0}}{{.Get 0 | markdownify}}{{else}}Note{{end}}</h2> -->
<!-- <h3>Note</h3> -->
<div class="admonition-content">{{- .Inner -}}</div>
<aside>
<div class="admonition-content bl bw2 b--blue" >
{{ .Inner }}
</div>
</aside>

View File

@@ -1,11 +0,0 @@
{{$file := .Get "file"}}
{{$icon := index (split $file ".") 1 }}
<div class="code" id="{{$file | urlize}}">
<div class="filename" title="{{$file}}">{{$file}}</div>
<!-- <div class="code-icon">
<i class="icon-{{$icon}}"></i>
</div> -->
<div class="code-copy-content output-content">
{{- .Inner -}}
</div>
</div>

View File

@@ -0,0 +1,37 @@
{{/*
Renders the child sections of the given top-level section, listing each childs's immediate descendants.
@param {string} section The top-level section to render.
@returns template.HTML
@example {{% quick-reference section="functions" %}}
*/}}
{{ $section := "" }}
{{ with .Get "section" }}
{{ $section = . }}
{{ else }}
{{ errorf "The %q shortcodes requires a 'section' parameter. See %s" .Name .Postion }}
{{ end }}
{{/* Do not change the markdown indentation, and do not remove blank lines. */}}
{{ with site.GetPage $section }}
{{ range .Sections }}
## {{ .LinkTitle }}
{{ .RawContent }}
{{ range .Pages }}
{{ $aliases := "" }}
{{ if eq .Section "functions" }}
{{ $aliases = delimit .Params.action.aliases " or " }}
{{ end }}
[{{ .LinkTitle }}]({{ .RelPermalink }}) {{ with $aliases }}({{ . }}){{ end }}
: {{ .Description }}
{{ end }}
{{ end }}
{{ else }}
{{ errorf "The %q shortcodes was unable to find the %q section. See %s" .Name $section .Postion }}
{{ end }}

View File

@@ -1,6 +1,29 @@
{{$file := .Get "file"}}
{{- if eq (.Get "markdown") "true" -}}
{{- $file | readFile | markdownify -}}
{{- else -}}
{{ $file | readFile | safeHTML }}
{{- end -}}
{{- $highlight := or (.Get "highlight") "" }}
{{- $markdown := false }}
{{- if in (slice "false" false 0) (.Get "markdown") }}
{{- $markdown = false }}
{{- else if in (slice "true" true 1) (.Get "markdown") }}
{{- $markdown = true }}
{{- end }}
{{- with .Get "file" }}
{{- if os.FileExists . }}
{{- with os.ReadFile . }}
{{- $content := trim . "\n\r" }}
{{- if $markdown }}
{{- $content | markdownify }}
{{- else if $highlight }}
{{- highlight $content $highlight }}
{{- else }}
{{- $content | safeHTML }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode was unable to read %q. See %s" $.Name . $.Position }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }}
{{- end }}
{{- else }}
{{- errorf "The %q shortcode requires a 'file' parameter. See %s" $.Name $.Position }}
{{- end }}

View File

@@ -1,9 +0,0 @@
{{ $_hugo_config := `{ "version": 1 }` }}
<aside class="admonition tip">
<div class="tip-icon">
{{partial "svg/exclamation.svg" .}}
</div>
<!-- <h2 id="{{if .Get 0}}{{.Get 0 | urlize}}{{else}}tip{{end}}">{{if .Get 0}}{{.Get 0 | markdownify}}{{else}}Tip{{end}}</h2> -->
<!-- <h3>Tip</h3> -->
<div class="admonition-content">{{- .Inner -}}</div>
</aside>

View File

@@ -0,0 +1 @@
{{ if .Inner }}{{ end }}

View File

@@ -1,9 +0,0 @@
{{ $_hugo_config := `{ "version": 1 }` }}
<aside class="admonition warning">
<div class="admonition-icon">
{{partial "svg/exclamation.svg" .}}
</div>
<!-- <h2 id="{{if .Get 0}}{{.Get 0 | urlize}}{{else}}warning{{end}}">{{if .Get 0}}{{.Get 0 | markdownify}}{{else}}Warning{{end}}</h2> -->
<!-- <h3>Warning</h3> -->
<div class="admonition-content">{{- .Inner -}}</div>
</aside>

View File

@@ -1,11 +0,0 @@
<div class="video-wrapper" data-streaming="youtube" data-videoid="{{.Get "id"}}" >
<i class="icon-video-play-button shortcode"></i>
{{if (.Get "thumbnail")}}
<div style="background-image:url(/images/thumbnails/{{.Get "thumbnail"}})" alt="YouTube Thumbnail" class="video-thumbnail"></div>
{{else}}
<div style="background-image:url(//img.youtube.com/vi/{{.Get "id"}}/0.jpg)" alt="YouTube Thumbnail" class="video-thumbnail"></div>
{{end}}
</div>
{{ if (.Get "description") }}
<div class="video-description">{{ .Get "description" | markdownify }}</div>
{{ end }}

View File

@@ -0,0 +1,55 @@
{{ $pkg := .Params.package}}
{{ $funcs := index site.Data.docs.tpl.funcs $pkg }}
{{ range $k, $v := $funcs }}
{{ if $v.Description }}
{{ $func := printf "%s.%s" $pkg $k }}
{{ $id := $func | anchorize | safeURL }}
<h2 id="{{ $id }}">
<a class="header-link" href="#{{ $id }}">
<svg class="fill-current o-60 hover-accent-color-light" height="22px" viewBox="0 0 24 24" width="22px" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/>
</svg>
</a>
{{ $func }}
</h2>
{{ with $v.Description }}
<p class="f4 lh-copy">
{{ . | $.RenderString | safeHTML }}
</p>
{{ end }}
<h4 class="minor mb3 pt2 primary-color-dark">
Syntax
</h4>
<div class="f5 mb4 ph3 pv2 bg-light-gray" style="border-left:4px solid #0594CB;">
{{ $pkg }}.{{ $k }}
{{ with $v.Args }}
<span class="ttu">
{{ delimit $v.Args ", "}}
</span>
{{ end }}
<span></span>
</div>
{{ if $v.Examples }}
<h4 class="minor mb3 pt2 primary-color-dark">
Examples
</h4>
{{ end }}
{{ range $v.Examples }}
{{ $input := index . 0 }}
{{ $result := index . 1 }}
{{ $example := printf "%s ---> %s" $input $result }}
{{ highlight $example "go-html-template" "" }}
{{ end }}
{{ with $v.Aliases }}
<h4 class="minor mb3 pt2 primary-color-dark">
Aliases
</h4>
<p>
{{ delimit . ", "}}
</p>
{{ end }}
{{ end }}
{{ end }}