mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
Merge commit 'b3d87dd0fd746f07f9afa6e6a2969aea41da6a38'
This commit is contained in:
29
docs/layouts/_shortcodes/deprecated-in.html
Normal file
29
docs/layouts/_shortcodes/deprecated-in.html
Normal file
@@ -0,0 +1,29 @@
|
||||
{{/* prettier-ignore-start */ -}}
|
||||
{{- /*
|
||||
Renders a callout indicating the version in which a feature was deprecated.
|
||||
|
||||
Include descriptive text between the opening and closing tags, or omit the
|
||||
descriptive text and call the shortcode with a self-closing tag.
|
||||
|
||||
@param {string} 0 The semantic version string, with or without a leading v.
|
||||
|
||||
@example {{< deprecated-in 0.144.0 />}}
|
||||
|
||||
@example {{< deprecated-in 0.144.0 >}}
|
||||
Some descriptive text here.
|
||||
{{< /deprecated-in >}}
|
||||
*/ -}}
|
||||
{{/* prettier-ignore-end */ -}}
|
||||
{{- with $version := .Get 0 | strings.TrimLeft "vV" }}
|
||||
{{- $href := printf "https://github.com/gohugoio/hugo/releases/tag/v%s" $version }}
|
||||
{{- $inner := strings.TrimSpace $.Inner }}
|
||||
{{- $text := printf "Deprecated in [v%s](%s)\n\n%s" $version $href $inner | $.Page.RenderString (dict "display" "block") }}
|
||||
{{- partial "layouts/blocks/alert.html" (dict
|
||||
"color" "orange"
|
||||
"icon" "exclamation"
|
||||
"text" $text
|
||||
)
|
||||
}}
|
||||
{{- else }}
|
||||
{{- errorf "The %q shortcode requires a single positional parameter indicating version. See %s" .Name .Position }}
|
||||
{{- end }}
|
Reference in New Issue
Block a user