theme: Format layouts

```
npx prettier --write layouts
```
This commit is contained in:
Bjørn Erik Pedersen 2025-02-18 10:31:09 +01:00
parent aa3cd839a2
commit e68431034e
28 changed files with 154 additions and 114 deletions

View File

@ -2,7 +2,6 @@
**/icons.html **/icons.html
# These are whitespace sensitive. # These are whitespace sensitive.
layouts/_default/_markup/render-code* layouts/_default/_markup/render-code*
layouts/shortcodes/glossary.html
# Odd template syntax. # Odd template syntax.
layouts/_default/_markup/render-heading* layouts/_default/_markup/render-heading*
@ -13,3 +12,4 @@ layouts/partials/layouts/head/head.html
# Auto generated. # Auto generated.
assets/css/components/chroma*.css assets/css/components/chroma*.css
assets/jsconfig.json assets/jsconfig.json

View File

@ -7,7 +7,7 @@
<img <img
src="{{ `images/gopher-side_color.svg` | relURL }}" src="{{ `images/gopher-side_color.svg` | relURL }}"
alt="gopher" alt="gopher"
class="w-32 ml-12 float-right" /> class="w-32 ml-12 float-right">
</h1> </h1>
<div class="mt-10 flex items-center justify-center gap-x-6"> <div class="mt-10 flex items-center justify-center gap-x-6">

View File

@ -1,3 +1,4 @@
{{/* prettier-ignore-start */ -}}
{{- /* Last modified: 2025-01-19T14:44:56-08:00 */}} {{- /* Last modified: 2025-01-19T14:44:56-08:00 */}}
{{- /* {{- /*
@ -76,7 +77,7 @@ either of these shortcodes in conjunction with this render hook.
@returns {template.html} @returns {template.html}
*/}} */}}
{{/* prettier-ignore-end */ -}}
{{- /* Initialize. */}} {{- /* Initialize. */}}
{{- $renderHookName := "link" }} {{- $renderHookName := "link" }}
@ -185,24 +186,26 @@ either of these shortcodes in conjunction with this render hook.
{{- end }} {{- end }}
{{- /* Render anchor element. */ -}} {{- /* Render anchor element. */ -}}
<a aria-label="{{ .PlainText }}" <a
{{- with .Title }} title="{{ . }}" {{- end }} aria-label="{{ .PlainText }}"
{{- with .Title }}title="{{ . }}"{{- end }}
{{- range $k, $v := $attrs }} {{- range $k, $v := $attrs }}
{{- if $v }} {{- if $v }}
{{- printf " %s=%q" $k ($v | transform.HTMLEscape) | safeHTMLAttr }} {{- printf " %s=%q" $k ($v | transform.HTMLEscape) | safeHTMLAttr }}
{{- end }} {{- end }}
{{- end -}} {{- end -}}
>{{ .Text }}</a> >{{ .Text }}</a
>
{{- define "partials/inline/h-rh-l/validate-fragment.html" }} {{- define "partials/inline/h-rh-l/validate-fragment.html" }}
{{- /* {{- /*
Validates the fragment portion of a link destination. Validates the fragment portion of a link destination.
@context {string} contentPath The page containing the link. @context {string} contentPath The page containing the link.
@context {string} errorLevel The error level when unable to resolve destination; ignore (default), warning, or error. @context {string} 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 {page} page The page corresponding to the link destination
@context {struct} parsedURL The link destination parsed by urls.Parse. @context {struct} parsedURL The link destination parsed by urls.Parse.
@context {string} renderHookName The name of the render hook. @context {string} renderHookName The name of the render hook.
*/}} */}}
{{- /* Initialize. */}} {{- /* Initialize. */}}
@ -248,20 +251,20 @@ either of these shortcodes in conjunction with this render hook.
{{- define "partials/inline/h-rh-l/get-glossary-link-attributes.html" }} {{- define "partials/inline/h-rh-l/get-glossary-link-attributes.html" }}
{{- /* {{- /*
Returns the anchor element attributes for a link to the given glossary term. Returns the anchor element attributes for a link to the given glossary term.
It first checks for the existence of a glossary page for the given term. If It first checks for the existence of a glossary page for the given term. If
no page is found, it then checks for a glossary page for the singular form of no page is found, it then checks for a glossary page for the singular form of
the term. If neither page exists it throws a warning or error dependent on the term. If neither page exists it throws a warning or error dependent on
the errorLevel setting the errorLevel setting
The returned href attribute does not point to the glossary term page. The returned href attribute does not point to the glossary term page.
Instead, via its fragment, it points to an entry on the glossary page. Instead, via its fragment, it points to an entry on the glossary page.
@context {string} contentPath The page containing the link. @context {string} contentPath The page containing the link.
@context {string} errorLevel The error level when unable to resolve destination; ignore (default), warning, or error. @context {string} errorLevel The error level when unable to resolve destination; ignore (default), warning, or error.
@context {string} renderHookName The name of the render hook. @context {string} renderHookName The name of the render hook.
@context {string} text The link text. @context {string} text The link text.
*/}} */}}
{{- /* Get context.. */}} {{- /* Get context.. */}}
@ -308,7 +311,7 @@ either of these shortcodes in conjunction with this render hook.
{{- end }} {{- end }}
{{- /* Create the href attribute. */}} {{- /* Create the href attribute. */}}
{{- $href := ""}} {{- $href := "" }}
{{- if $termActual }} {{- if $termActual }}
{{- $href = fmt.Printf "%s#%s" $glossaryPage.RelPermalink (anchorize $termActual) }} {{- $href = fmt.Printf "%s#%s" $glossaryPage.RelPermalink (anchorize $termActual) }}
{{- end }} {{- end }}

View File

@ -1,9 +1,9 @@
{{ define "main" }} {{ define "main" }}
<div class="flex flex-col w-full p-0 m-0"> <div class="flex flex-col w-full p-0 m-0">
{{ partial "layouts/home/opensource.html" . }} {{ partial "layouts/home/opensource.html" . }}
<hr class="border-t border-gray-200 dark:border-gray-800 my-10 lg:my-14" /> <hr class="border-t border-gray-200 dark:border-gray-800 my-10 lg:my-14">
{{ partial "layouts/home/sponsors.html" (dict "ctx" . "gtag" "home" ) }} {{ partial "layouts/home/sponsors.html" (dict "ctx" . "gtag" "home" ) }}
<hr class="border-t border-gray-200 dark:border-gray-800 my-10 lg:my-14" /> <hr class="border-t border-gray-200 dark:border-gray-800 my-10 lg:my-14">
{{ partial "layouts/home/features.html" . }} {{ partial "layouts/home/features.html" . }}
</div> </div>
{{ end }} {{ end }}
@ -15,7 +15,7 @@
<img <img
src="{{ `images/hugo-logo-wide.svg`| relURL }}" src="{{ `images/hugo-logo-wide.svg`| relURL }}"
alt="Hugo Logo" alt="Hugo Logo"
class="w-64 aspect-3/1 mx-auto mb-8" /> class="w-64 aspect-3/1 mx-auto mb-8">
<h1 <h1
class="text-4xl font-bold tracking-tight text-balance text-gray-900 dark:text-gray-300 sm:text-6xl"> class="text-4xl font-bold tracking-tight text-balance text-gray-900 dark:text-gray-300 sm:text-6xl">
The worlds fastest framework for building websites The worlds fastest framework for building websites

View File

@ -1,3 +1,4 @@
{{/* prettier-ignore-start */ -}}
{{/* {{/*
Parses the serialized data from the given URL and returns a map or an array. Parses the serialized data from the given URL and returns a map or an array.
@ -8,7 +9,7 @@ Supports CSV, JSON, TOML, YAML, and XML.
@example {{ partial "get-remote-data.html" "https://example.org/foo.json" }} @example {{ partial "get-remote-data.html" "https://example.org/foo.json" }}
*/}} */}}
{{/* prettier-ignore-end */ -}}
{{ $url := . }} {{ $url := . }}
{{ $data := dict }} {{ $data := dict }}
{{ with try (resources.GetRemote $url) }} {{ with try (resources.GetRemote $url) }}

View File

@ -5,7 +5,7 @@
<link <link
rel="stylesheet" rel="stylesheet"
href="{{ $r.RelPermalink }}" href="{{ $r.RelPermalink }}"
{{ template `render-attributes` $attr }} /> {{ template `render-attributes` $attr }}>
{{ else }} {{ else }}
{{ with $r | minify | fingerprint }} {{ with $r | minify | fingerprint }}
<link <link
@ -13,7 +13,7 @@
href="{{ .RelPermalink }}" href="{{ .RelPermalink }}"
integrity="{{ .Data.Integrity }}" integrity="{{ .Data.Integrity }}"
crossorigin="anonymous" crossorigin="anonymous"
{{ template `render-attributes` $attr }} /> {{ template `render-attributes` $attr }}>
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@ -9,17 +9,17 @@
<source <source
srcset="{{ $imageWebp.RelPermalink }}" srcset="{{ $imageWebp.RelPermalink }}"
type="image/webp" type="image/webp"
media="(min-width: 1200px)" /> media="(min-width: 1200px)">
<source <source
srcset="{{ $image.RelPermalink }}" srcset="{{ $image.RelPermalink }}"
type="image/jpeg" type="image/jpeg"
media="(min-width: 1200px)" /> media="(min-width: 1200px)">
<source srcset="{{ $image1xWebp.RelPermalink }}" type="image/webp" /> <source srcset="{{ $image1xWebp.RelPermalink }}" type="image/webp">
<source srcset="{{ $image1x.RelPermalink }}" type="image/jpeg" /> <source srcset="{{ $image1x.RelPermalink }}" type="image/jpeg">
<img <img
class="{{ $class }}" class="{{ $class }}"
src="{{ $image1x.RelPermalink }}" src="{{ $image1x.RelPermalink }}"
alt="" alt=""
width="{{ $image1x.Width }}" width="{{ $image1x.Width }}"
height="{{ $image1x.Height }}" /> height="{{ $image1x.Height }}">
</picture> </picture>

View File

@ -1,4 +1,5 @@
<footer class="print:hidden bg-blue-950 mt-8 sm:mt-24 border-t-1 border-gray-800"> <footer
class="print:hidden bg-blue-950 mt-8 sm:mt-24 border-t-1 border-gray-800">
<div class="mx-auto max-w-7xl pt-16 pb-8 sm:pt-18 lg:pt-20"> <div class="mx-auto max-w-7xl pt-16 pb-8 sm:pt-18 lg:pt-20">
<div class="xl:grid xl:grid-cols-3 xl:gap-8"> <div class="xl:grid xl:grid-cols-3 xl:gap-8">
{{/* Column 1 */}} {{/* Column 1 */}}
@ -9,13 +10,13 @@
href="https://github.com/gohugoio/hugo/graphs/contributors" href="https://github.com/gohugoio/hugo/graphs/contributors"
class="text-blue-300 hover:underline" class="text-blue-300 hover:underline"
>Hugo Authors</a >Hugo Authors</a
><br /> ><br>
</div> </div>
<img <img
src="/images/hugo-logo-wide.svg" src="/images/hugo-logo-wide.svg"
alt="Hugo Logo" alt="Hugo Logo"
class="aspect-3/1 w-40" /> class="aspect-3/1 w-40">
<ul class="space-y-2 text-gray-200"> <ul class="space-y-2 text-gray-200">
<li class="hover:text-white"> <li class="hover:text-white">

View File

@ -20,6 +20,6 @@
height="{{ .Height }}" height="{{ .Height }}"
@load="$event.target.classList.remove('_opacity-0')" @load="$event.target.classList.remove('_opacity-0')"
alt="QR code linking to {{ $.page.Permalink }}" alt="QR code linking to {{ $.page.Permalink }}"
class="{{ $img_class }}" /> class="{{ $img_class }}">
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@ -1,5 +1,5 @@
<div class="print:hidden"> <div class="print:hidden">
<hr class="border-t border-gray-200 dark:border-gray-800 my-10 lg:my-16" /> <hr class="border-t border-gray-200 dark:border-gray-800 my-10 lg:my-16">
<div class="text-gray-800 dark:text-gray-300 font-semibold"> <div class="text-gray-800 dark:text-gray-300 font-semibold">
Last updated: Last updated:

View File

@ -5,6 +5,7 @@
{{ $fillColor = "fill-slate-500 dark:fill-slate-400" }} {{ $fillColor = "fill-slate-500 dark:fill-slate-400" }}
{{ end }} {{ end }}
<button <button
{{ if .standalone }} {{ if .standalone }}
x-data @click="$dispatch('search-toggle')" x-data @click="$dispatch('search-toggle')"
@ -13,7 +14,7 @@
aria-label="Search" aria-label="Search"
class="{{ $textColor }} grid cursor-pointer w-full lg:w-56 grid-cols-[auto_1fr_auto] items-center rounded-md px-2 sm:px-4 py-2 text-left text-xs/6 lg:text-sm/6 outline-0 sm:outline-1 -outline-offset-1 outline-gray-600"> class="{{ $textColor }} grid cursor-pointer w-full lg:w-56 grid-cols-[auto_1fr_auto] items-center rounded-md px-2 sm:px-4 py-2 text-left text-xs/6 lg:text-sm/6 outline-0 sm:outline-1 -outline-offset-1 outline-gray-600">
<svg <svg
class="{{ $fillColor}} pointer-events-none -ml-0.5 mr-2 size-5 sm:size-4"> class="{{ $fillColor }} pointer-events-none -ml-0.5 mr-2 size-5 sm:size-4">
<use href="#icon--search"></use> <use href="#icon--search"></use>
</svg> </svg>
<span class="hidden lg:inline">Search docs</span> <span class="hidden lg:inline">Search docs</span>

View File

@ -34,7 +34,7 @@
arial-label="Search" arial-label="Search"
class="text-gray-800 dark:text-gray-100 bg-white/40 dark:bg-gray-900 shadow rounded border-0 p-3 w-full" class="text-gray-800 dark:text-gray-100 bg-white/40 dark:bg-gray-900 shadow rounded border-0 p-3 w-full"
placeholder="Search docs" placeholder="Search docs"
x-ref="input" /> x-ref="input">
</div> </div>
</div> </div>
<div class="relative mt-6 flex-1 px-4 sm:px-6"> <div class="relative mt-6 flex-1 px-4 sm:px-6">

View File

@ -1,4 +1,4 @@
<meta property="og:title" content="{{ .Title }}" /> <meta property="og:title" content="{{ .Title }}">
<meta <meta
property="og:description" property="og:description"
content="{{ with .Description }} content="{{ with .Description }}
@ -9,56 +9,56 @@
{{ else }} {{ else }}
{{ with .Site.Params.description }}{{ . }}{{ end }} {{ with .Site.Params.description }}{{ . }}{{ end }}
{{ end }} {{ end }}
{{ end }}" /> {{ end }}">
<meta <meta
property="og:type" property="og:type"
content="{{ if .IsPage }} content="{{ if .IsPage }}
article article
{{ else }} {{ else }}
website website
{{ end }}" /> {{ end }}">
<meta property="og:url" content="{{ .Permalink }}" /> <meta property="og:url" content="{{ .Permalink }}">
{{- with $.Params.images -}} {{- with $.Params.images -}}
{{- range first 6 . }} {{- range first 6 . }}
<meta property="og:image" content="{{ . | absURL }}" /> <meta property="og:image" content="{{ . | absURL }}">
{{ end -}} {{ end -}}
{{- else -}} {{- else -}}
{{- $featured := partial "opengraph/get-featured-image.html" . }} {{- $featured := partial "opengraph/get-featured-image.html" . }}
{{- with $featured -}} {{- with $featured -}}
<meta property="og:image" content="{{ $featured.Permalink }}" /> <meta property="og:image" content="{{ $featured.Permalink }}">
{{- else -}} {{- else -}}
{{- with $.Site.Params.images }} {{- with $.Site.Params.images }}
<meta property="og:image" content="{{ index . 0 | absURL }}" /> <meta property="og:image" content="{{ index . 0 | absURL }}">
{{ end -}} {{ end -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- if .IsPage }} {{- if .IsPage }}
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
<meta property="article:section" content="{{ .Section }}" /> <meta property="article:section" content="{{ .Section }}">
{{ with .PublishDate }} {{ with .PublishDate }}
<meta <meta
property="article:published_time" property="article:published_time"
{{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} /> {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }}>
{{ end }} {{ end }}
{{ with .Lastmod }} {{ with .Lastmod }}
<meta <meta
property="article:modified_time" property="article:modified_time"
{{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} /> {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }}>
{{ end }} {{ end }}
{{- end -}} {{- end -}}
{{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }} {{- with .Params.audio }}<meta property="og:audio" content="{{ . }}">{{ end }}
{{- with .Params.locale }} {{- with .Params.locale }}
<meta property="og:locale" content="{{ . }}" /> <meta property="og:locale" content="{{ . }}">
{{ end }} {{ end }}
{{- with .Site.Params.title }} {{- with .Site.Params.title }}
<meta property="og:site_name" content="{{ . }}" /> <meta property="og:site_name" content="{{ . }}">
{{ end }} {{ end }}
{{- with .Params.videos }} {{- with .Params.videos }}
{{- range . }} {{- range . }}
<meta property="og:video" content="{{ . | absURL }}" /> <meta property="og:video" content="{{ . | absURL }}">
{{ end }} {{ end }}
{{ end }} {{ end }}
@ -71,7 +71,7 @@
{{- $series := index $siteSeries ($name | urlize) }} {{- $series := index $siteSeries ($name | urlize) }}
{{- range $page := first 6 $series.Pages }} {{- range $page := first 6 $series.Pages }}
{{- if ne $page.Permalink $permalink }} {{- if ne $page.Permalink $permalink }}
<meta property="og:see_also" content="{{ $page.Permalink }}" /> <meta property="og:see_also" content="{{ $page.Permalink }}">
{{ end }} {{ end }}
{{- end }} {{- end }}
{{ end }} {{ end }}
@ -80,5 +80,5 @@
{{- /* Facebook Page Admin ID for Domain Insights */}} {{- /* Facebook Page Admin ID for Domain Insights */}}
{{- with site.Params.social.facebook_admin }} {{- with site.Params.social.facebook_admin }}
<meta property="fb:admins" content="{{ . }}" /> <meta property="fb:admins" content="{{ . }}">
{{ end }} {{ end }}

View File

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

View File

@ -9,31 +9,33 @@
{{ $fields := after 3 .Params }} {{ $fields := after 3 .Params }}
{{ $list := where $list $filter1 $filter2 $filter3 }} {{ $list := where $list $filter1 $filter2 $filter3 }}
<table class="table table-bordered"> <table class="table table-bordered">
<tr> <tr>
{{ range $fields }} {{ range $fields }}
<th>{{ . }}</th> <th>{{ . }}</th>
{{ end }} {{ end }}
</tr> </tr>
{{ range $list }} {{ range $list }}
<tr> <tr>
{{ range $k, $v := . }} {{ range $k, $v := . }}
{{ $.Scratch.Set $k $v }} {{ $.Scratch.Set $k $v }}
{{ end }} {{ end }}
{{ range $k, $v := $fields }} {{ range $k, $v := $fields }}
<td> <td>
{{ $tdContent := $.Scratch.Get . }} {{ $tdContent := $.Scratch.Get . }}
{{ if eq $k 3 }} {{ if eq $k 3 }}
{{ printf "%v" $tdContent | {{ printf "%v" $tdContent |
strings.ReplaceRE `\[` "<ol><li>" | strings.ReplaceRE `\[` "<ol><li>" |
strings.ReplaceRE `\s` "</li><li>" | strings.ReplaceRE `\s` "</li><li>" |
strings.ReplaceRE `\]` "</li></ol>" | strings.ReplaceRE `\]` "</li></ol>" |
safeHTML }} safeHTML
{{ else }} }}
{{ $tdContent }} {{ else }}
{{ end}} {{ $tdContent }}
</td> {{ end }}
{{ end }} </td>
</tr> {{ end }}
{{ end }} </tr>
{{ end }}
</table> </table>

View File

@ -1,3 +1,4 @@
{{/* prettier-ignore-start */ -}}
{{- /* {{- /*
Renders a callout indicating the version in which a feature was deprecated. Renders a callout indicating the version in which a feature was deprecated.
@ -16,6 +17,7 @@
{{< /new-in >}} {{< /new-in >}}
*/}} */}}
{{/* prettier-ignore-end */ -}}
{{- with $version := .Get 0 | strings.TrimLeft "vV" }} {{- with $version := .Get 0 | strings.TrimLeft "vV" }}
{{- $href := printf "https://github.com/gohugoio/hugo/releases/tag/v%s" $version }} {{- $href := printf "https://github.com/gohugoio/hugo/releases/tag/v%s" $version }}
{{- $inner := strings.TrimSpace $.Inner }} {{- $inner := strings.TrimSpace $.Inner }}

View File

@ -1,3 +1,4 @@
{{/* prettier-ignore-start */ -}}
{{- /* {{- /*
Renders an absolute URL to the source code for an embedded template. Renders an absolute URL to the source code for an embedded template.
@ -11,13 +12,13 @@ embedded_templates.toml file in the data directory.
@example {{% et robots.txt %}} @example {{% et robots.txt %}}
@example {{% et filename=robots.txt %}} @example {{% et filename=robots.txt %}}
*/}} */}}
{{/* prettier-ignore-end */ -}}
{{- /* Get parameters. */}} {{- /* Get parameters. */}}
{{- $filename := "" -}} {{- $filename := "" -}}
{{- if .IsNamedParams -}} {{- if .IsNamedParams -}}
{{- $filename = .Get "filename" -}} {{- $filename = .Get "filename" -}}
{{- else -}} {{- else -}}
{{- $filename = .Get 0 -}} {{- $filename = .Get 0 -}}
{{- end -}} {{- end -}}
{{- /* Render. */}} {{- /* Render. */}}
@ -32,5 +33,5 @@ embedded_templates.toml file in the data directory.
{{- errorf "The %q shortcode was unable to find the embedded_template_urls data file in the site's data directory. See %s" $.Name $.Position -}} {{- errorf "The %q shortcode was unable to find the embedded_template_urls data file in the site's data directory. See %s" $.Name $.Position -}}
{{- end -}} {{- end -}}
{{- else -}} {{- else -}}
{{- errorf "The %q shortcodes requires a named or positional parameter, the file name of the embedded template, excluding its extension. See %s" .Name .Position -}} {{- errorf "The %q shortcodes requires a named or positional parameter, the file name of the embedded template, excluding its extension. See %s" .Name .Position -}}
{{- end -}} {{- end -}}

View File

@ -1,3 +1,4 @@
{{/* prettier-ignore-start */ -}}
{{- /* {{- /*
Renders the definition of the given glossary term. Renders the definition of the given glossary term.
@ -7,11 +8,13 @@ Renders the definition of the given glossary term.
@example {{% glossary-term float %}} @example {{% glossary-term float %}}
@example {{% glossary-term "floating point" %}} @example {{% glossary-term "floating point" %}}
*/}} */}}
{{/* prettier-ignore-end */ -}}
{{- with .Get 0 }} {{- with .Get 0 }}
{{- $path := printf "/quick-reference/glossary/%s" (urlize .) }} {{- $path := printf "/quick-reference/glossary/%s" (urlize .) }}
{{- with site.GetPage $path }} {{- with site.GetPage $path }}
{{/* prettier-ignore-start */ -}}
{{ .RenderShortcodes }}&nbsp;{{/* Do not indent. Do not remove non-breaking space. */}} {{ .RenderShortcodes }}&nbsp;{{/* Do not indent. Do not remove non-breaking space. */}}
{{/* prettier-ignore-end */ -}}
{{- else }} {{- else }}
{{- errorf "The glossary term (%s) shortcode was unable to find %s: see %s" $.Name $path $.Position }} {{- errorf "The glossary term (%s) shortcode was unable to find %s: see %s" $.Name $path $.Position }}
{{- end }} {{- end }}

View File

@ -1,3 +1,4 @@
{{/* prettier-ignore-start */ -}}
{{- /* {{- /*
Renders the glossary of terms. Renders the glossary of terms.
@ -54,3 +55,4 @@ shortcode.
{{- else }} {{- else }}
{{- errorf "The %q shortcode was unable to get %s: see %s" .Name $path .Position}} {{- errorf "The %q shortcode was unable to get %s: see %s" .Name $path .Position}}
{{- end }} {{- end }}
{{/* prettier-ignore-end */ -}}

View File

@ -1,11 +1,11 @@
{{- /* {{- /*
Returns syntax-highlighted code from the given text. Returns syntax-highlighted code from the given text.
This is useful as a terse way to highlight inline code snippets. Calling the This is useful as a terse way to highlight inline code snippets. Calling the
highlight shortcode for inline snippets is verbose. highlight shortcode for inline snippets is verbose.
*/}} */}}
{{- $code := .Inner | strings.TrimSpace }} {{- $code := .Inner | strings.TrimSpace }}
{{- $lang := or (.Get 0) "go" }} {{- $lang := or (.Get 0) "go" }}
{{- $opts := dict "hl_inline" true "noClasses" true }} {{- $opts := dict "hl_inline" true "noClasses" true }}
{{- transform.Highlight $code $lang $opts }} {{- transform.Highlight $code $lang $opts }}

View File

@ -1,3 +1,4 @@
{{/* prettier-ignore-start */ -}}
{{- /* {{- /*
Renders the given image using the given filter, if any. Renders the given image using the given filter, if any.
@ -84,7 +85,7 @@ Renders the given image using the given filter, if any.
>}} >}}
*/}} */}}
{{/* prettier-ignore-end */ -}}
{{- /* Initialize. */}} {{- /* Initialize. */}}
{{- $alt := "" }} {{- $alt := "" }}
{{- $src := "" }} {{- $src := "" }}
@ -105,7 +106,7 @@ Renders the given image using the given filter, if any.
{{- /* Get and validate parameters. */}} {{- /* Get and validate parameters. */}}
{{- with .Get "alt" }} {{- with .Get "alt" }}
{{- $alt = .}} {{- $alt = . }}
{{- end }} {{- end }}
{{- with .Get "src" }} {{- with .Get "src" }}
@ -138,7 +139,7 @@ Renders the given image using the given filter, if any.
{{- if in (slice "false" false 0) (.Get "example") }} {{- if in (slice "false" false 0) (.Get "example") }}
{{- $example = false }} {{- $example = false }}
{{- else if in (slice "true" true 1) (.Get "example")}} {{- else if in (slice "true" true 1) (.Get "example") }}
{{- $example = true }} {{- $example = true }}
{{- end }} {{- end }}
@ -334,11 +335,23 @@ Renders the given image using the given filter, if any.
{{- end }} {{- end }}
{{- if $example }} {{- if $example }}
<p>Original</p> <p>Original</p>
<img class="{{ $class}}" style="width: initial;" src="{{ $i.RelPermalink }}" alt="{{ $alt }}"> <img
class="{{ $class }}"
style="width: initial;"
src="{{ $i.RelPermalink }}"
alt="{{ $alt }}">
<p>Processed</p> <p>Processed</p>
<img class="{{ $class }}" style="width: initial;" src="{{ $fi.RelPermalink }}" alt="{{ $alt }}"> <img
class="{{ $class }}"
style="width: initial;"
src="{{ $fi.RelPermalink }}"
alt="{{ $alt }}">
{{- else -}} {{- else -}}
<img class='di' style="width: initial;" src="{{ $fi.RelPermalink }}" alt="{{ $alt }}"> <img
class="di"
style="width: initial;"
src="{{ $fi.RelPermalink }}"
alt="{{ $alt }}">
{{- end }} {{- end }}
{{- define "validate-arg-count" }} {{- define "validate-arg-count" }}
@ -387,5 +400,5 @@ Renders the given image using the given filter, if any.
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- return $r}} {{- return $r }}
{{- end -}} {{- end -}}

View File

@ -19,7 +19,7 @@
src="{{ .RelPermalink }}" src="{{ .RelPermalink }}"
width="{{ .Width }}" width="{{ .Width }}"
height="{{ .Height }}" height="{{ .Height }}"
alt="{{ $.Get `alt` }}" /> alt="{{ $.Get `alt` }}">
<figcaption class="not-prose text-sm"> <figcaption class="not-prose text-sm">
{{- with $.Inner }} {{- with $.Inner }}
{{ . }} {{ . }}

View File

@ -1,3 +1,4 @@
{{/* prettier-ignore-start */ -}}
{{- /* {{- /*
Renders the page using the RenderShortcode method on the Page object. Renders the page using the RenderShortcode method on the Page object.
@ -8,7 +9,7 @@ You must call this shortcode using the {{% %}} notation.
@example {{% include "functions/_common/glob-patterns" %}} @example {{% include "functions/_common/glob-patterns" %}}
*/}} */}}
{{/* prettier-ignore-end */ -}}
{{- with .Get 0 }} {{- with .Get 0 }}
{{- with or ($.Page.GetPage .) (site.GetPage .) }} {{- with or ($.Page.GetPage .) (site.GetPage .) }}
{{- .RenderShortcodes }} {{- .RenderShortcodes }}

View File

@ -1,3 +1,4 @@
{{/* prettier-ignore-start */ -}}
{{- /* {{- /*
Renders a description list of the pages in the given section. Renders a description list of the pages in the given section.
@ -30,9 +31,9 @@ omitElementIDs to true for the subset.
@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 >}}
@example {{< list-pages-in-section path=/functions/images filter=some_filter filterType=exclude titlePrefix=foo omitElementIDs=true >}} @example {{< list-pages-in-section path=/functions/images filter=some_filter filterType=exclude titlePrefix=foo omitElementIDs=true >}}
*/}} */}}
{{/* prettier-ignore-end */ -}}
{{- /* Initialize. */}} {{- /* Initialize. */}}
{{- $filter := or "" (.Get "filter" | lower)}} {{- $filter := or "" (.Get "filter" | lower) }}
{{- $filterType := or (.Get "filterType") "none" | lower }} {{- $filterType := or (.Get "filterType") "none" | lower }}
{{- $filteredPages := slice }} {{- $filteredPages := slice }}
{{- $titlePrefix := or (.Get "titlePrefix") "" }} {{- $titlePrefix := or (.Get "titlePrefix") "" }}
@ -41,7 +42,7 @@ omitElementIDs to true for the subset.
{{- /* Get boolean parameters. */}} {{- /* Get boolean parameters. */}}
{{- if in (slice "false" false 0) (.Get "omitElementIDs") }} {{- if in (slice "false" false 0) (.Get "omitElementIDs") }}
{{- $omitElementIDs = false }} {{- $omitElementIDs = false }}
{{- else if in (slice "true" true 1) (.Get "omitElementIDs")}} {{- else if in (slice "true" true 1) (.Get "omitElementIDs") }}
{{- $omitElementIDs = true }} {{- $omitElementIDs = true }}
{{- end }} {{- end }}
@ -73,14 +74,16 @@ omitElementIDs to true for the subset.
}} }}
{{- $linkTitle := .LinkTitle }} {{- $linkTitle := .LinkTitle }}
{{- with $titlePrefix }} {{- with $titlePrefix }}
{{- $linkTitle = printf "%s%s" . $linkTitle }} {{- $linkTitle = printf "%s%s" . $linkTitle }}
{{- end }} {{- end }}
{{- $idAttribute := "" }} {{- $idAttribute := "" }}
{{- if not $omitElementIDs }} {{- if not $omitElementIDs }}
{{- $id := path.Join .File.Dir .File.ContentBaseName | replaceRE `[\|/]` ":" | lower }} {{- $id := path.Join .File.Dir .File.ContentBaseName | replaceRE `[\|/]` ":" | lower }}
{{- $idAttribute = printf " id=%q" $id }} {{- $idAttribute = printf " id=%q" $id }}
{{- end }} {{- end }}
<dt {{- $idAttribute | safeHTMLAttr }}><a href="{{ $page.RelPermalink }}">{{ $linkTitle }}</a></dt> <dt {{- $idAttribute | safeHTMLAttr }}>
<a href="{{ $page.RelPermalink }}">{{ $linkTitle }}</a>
</dt>
<dd>{{- $page.Description | $page.RenderString }}</dd> <dd>{{- $page.Description | $page.RenderString }}</dd>
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

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

View File

@ -1,3 +1,4 @@
{{/* prettier-ignore-start */ -}}
{{- /* {{- /*
Renders a callout or badge indicating the version in which a feature was added. Renders a callout or badge indicating the version in which a feature was added.
@ -22,6 +23,7 @@
Some descriptive text here. Some descriptive text here.
{{< /new-in >}} {{< /new-in >}}
*/}} */}}
{{/* prettier-ignore-end */ -}}
{{- $majorVersionDiffThreshold := 0 }} {{- $majorVersionDiffThreshold := 0 }}
{{- $minorVersionDiffThreshold := 30 }} {{- $minorVersionDiffThreshold := 30 }}
{{- $displayExpirationWarning := true }} {{- $displayExpirationWarning := true }}

View File

@ -1,3 +1,4 @@
{{/* prettier-ignore-start */ -}}
{{- /* {{- /*
Renders a callout. Renders a callout.
@ -9,6 +10,7 @@
Some descriptive text here. Some descriptive text here.
{{< /note >}} {{< /note >}}
*/}} */}}
{{/* prettier-ignore-end */ -}}
{{- $text := .Inner | strings.TrimSpace | .Page.RenderString (dict "display" "block") }} {{- $text := .Inner | strings.TrimSpace | .Page.RenderString (dict "display" "block") }}
{{- partial "layouts/blocks/alert.html" (dict {{- partial "layouts/blocks/alert.html" (dict
"color" "blue" "color" "blue"

View File

@ -1,3 +1,4 @@
{{/* prettier-ignore-start */ -}}
{{/* {{/*
Renders the child sections of the given top-level section, listing each child's immediate descendants. Renders the child sections of the given top-level section, listing each child's immediate descendants.
@ -37,3 +38,4 @@ Renders the child sections of the given top-level section, listing each child's
{{ else }} {{ else }}
{{ errorf "The %q shortcodes was unable to find the %q section. See %s" .Name $section .Position }} {{ errorf "The %q shortcodes was unable to find the %q section. See %s" .Name $section .Position }}
{{ end }} {{ end }}
{{/* prettier-ignore-end */ -}}