mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'
This commit is contained in:
@@ -1,17 +1,29 @@
|
||||
{{ $_hugo_config := `{ "version": 1 }` }}
|
||||
{{/* prettier-ignore-start */ -}}
|
||||
{{- /*
|
||||
Renders a callout indicating the version in which a feature was deprecated.
|
||||
|
||||
{{ with .Get 0 }}
|
||||
{{ $version := printf "v%v" (strings.TrimLeft "vV" .) }}
|
||||
{{ $href := printf "https://github.com/gohugoio/hugo/releases/tag/%s" $version }}
|
||||
{{ $text := (printf `Deprecated in <a href="%s">%s</a>.
|
||||
%s` $href $version $.Inner) | safeHTML }}
|
||||
Include descriptive text between the opening and closing tags, or omit the
|
||||
descriptive text and call the shortcode with a self-closing tag.
|
||||
|
||||
{{ partial "layouts/blocks/alert.html" (dict
|
||||
"text" $text
|
||||
"color" "orange"
|
||||
"icon" "exclamation"
|
||||
)
|
||||
}}
|
||||
{{ else }}
|
||||
{{ errorf "The %q shortcode requires a single positional parameter indicating version. See %s" .Name .Position }}
|
||||
{{ end }}
|
||||
@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