Merge commit '7125ad401ad043e46262afc7eca8dceb6d54bb9e'

This commit is contained in:
Bjørn Erik Pedersen
2024-01-26 08:22:42 +01:00
141 changed files with 904 additions and 813 deletions

View File

@@ -1,4 +1,4 @@
// Grab any element that has the 'js-toggle' class and add an event listner for the toggleClass function
// Grab any element that has the 'js-toggle' class and add an event listener for the toggleClass function
var toggleBtns = document.getElementsByClassName('js-toggle')
for (var i = 0; i < toggleBtns.length; i++) {
toggleBtns[i].addEventListener('click', toggleClass, false)

View File

@@ -201,7 +201,7 @@ either of these shortcodes in conjunction with this render hook.
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 {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 {struct} parsedURL The link destination parsed by urls.Parse.
@context {string} renderHookName The name of the render hook.

View File

@@ -1,9 +1,21 @@
{{/*
Disable Twitter for now as we lost access to the account.
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>
{{ end */}}
<a rel="me" class="mstdn mr3" href="https://fosstodon.org/@gohugoio" target="_blank">gohugoio</a>
<a class="github-button needs-js link primary-color-dark" href="https://github.com/gohugoio/hugo" data-size="large" data-show-count="false" aria-label="Star gohugoio/hugo on GitHub">Star</a>
<a
href="https://twitter.com/intent/follow?screen_name=gohugoiov2"
title="Follow on Twitter"
class="link-transition twitter link dib z-999 pt3 pt0-l mr2">
{{ partial "svg/twitter.svg" (dict "size" "32px") }}
</a>
<a
rel="me"
class="mstdn mr3"
href="https://fosstodon.org/@gohugoio"
target="_blank"
>gohugoio</a
>
<a
class="github-button needs-js link primary-color-dark"
href="https://github.com/gohugoio/hugo"
data-size="large"
data-show-count="false"
aria-label="Star gohugoio/hugo on GitHub"
>Star</a
>

View File

@@ -5,7 +5,7 @@
{{ $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>
<p>Deprecated in <a href="{{ $href }}">{{ $version }}</a>.</p>
{{ $.Inner }}
</div>
</aside>

View File

@@ -100,7 +100,7 @@ Renders the given image using the given filter, if any.
"fontSize" 64
"lineHeight" 1.2
"fontColor" "#ffffff"
"fontPath" "https://github.com/google/fonts/raw/main/apache/roboto/static/Roboto-Regular.ttf"
"fontPath" "https://github.com/google/fonts/raw/main/ofl/lato/Lato-Regular.ttf"
}}
{{- /* Get and validate parameters. */}}
@@ -119,9 +119,10 @@ Renders the given image using the given filter, if any.
{{- end }}
{{- $validFilters := slice
"brightness" "colorbalance" "colorize" "contrast" "gamma" "gaussianblur"
"grayscale" "hue" "invert" "none" "opacity" "overlay" "padding" "pixelate"
"process" "saturation" "sepia" "sigmoid" "text" "unsharpmask"
"autoorient" "brightness" "colorbalance" "colorize" "contrast" "gamma"
"gaussianblur" "grayscale" "hue" "invert" "none" "opacity" "overlay"
"padding" "pixelate" "process" "saturation" "sepia" "sigmoid" "text"
"unsharpmask"
}}
{{- with $filter }}
@@ -157,7 +158,11 @@ Renders the given image using the given filter, if any.
{{- /* Create filter. */}}
{{- $f := "" }}
{{- $ctx := dict "filter" $filter "args" $filterArgs "name" .Name "position" .Position }}
{{- if eq $filter "brightness" }}
{{- if eq $filter "autoorient" }}
{{- $ctx = merge $ctx (dict "argsRequired" 0) }}
{{- template "validate-arg-count" $ctx }}
{{- $f = images.AutoOrient }}
{{- else if eq $filter "brightness" }}
{{- $ctx = merge $ctx (dict "argsRequired" 1) }}
{{- template "validate-arg-count" $ctx }}
{{- $filterArgs = apply $filterArgs "float" "." }}

View File

@@ -3,7 +3,7 @@ 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.
@param {string} (positional parameter 0) The path to the page, relative to the content directory.
@returns template.HTML
@example {{% include "functions/_common/glob-patterns" %}}

View File

@@ -1,5 +1,5 @@
{{- /*
Renders a desciption list of the pages in the given section.
Renders a description 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.

View File

@@ -1,13 +1,36 @@
{{ $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>
{{- /*
Renders a "new in" button indicating the version in which a feature was added.
When comparing the current version to the specified version, the "new in"
button will be hidden if any of the following conditions is true:
- The major version difference exceeds the majorVersionDiffThreshold
- The minor version difference exceeds the minorVersionDiffThreshold
@param {string} version The semantic version string, with or without a leading v.
@returns {template.HTML}
@example {{< new-in 0.100.0 >}}
*/}}
{{- /* Set defaults. */}}
{{- $majorVersionDiffThreshold := 0 }}
{{- $minorVersionDiffThreshold := 30 }}
{{- $displayExpirationWarning := true }}
{{- /* Render. */}}
{{- with $version := .Get 0 | strings.TrimPrefix "v" }}
{{- $majorVersionDiff := sub (index (split hugo.Version ".") 0 | int) (index (split $version ".") 0 | int) }}
{{- $minorVersionDiff := sub (index (split hugo.Version ".") 1 | int) (index (split $version ".") 1 | int) }}
{{- if or (gt $majorVersionDiff $majorVersionDiffThreshold) (gt $minorVersionDiff $minorVersionDiffThreshold) }}
{{- if $displayExpirationWarning }}
{{- warnf "This call to the %q shortcode should be removed: %s. The button is now hidden because the specified version (%s) is older than the display threshold." $.Name $.Position $version }}
{{- end }}
{{- else }}
<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 }}">New in v{{ $version }}</a>
</button>
{{- end }}
{{- else }}
{{- errorf "The %q shortcode requires a positional parameter (version). See %s" .Name .Position }}
{{- end -}}

View File

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