Add shortcode for feature gate description

pull/41793/head
Tim Bannister 2023-07-13 12:12:58 +01:00
parent 22ff0d31a6
commit 4a4fe5ccb9
1 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,17 @@
{{- $id := .Get "name" -}}
{{- $featureGatesBundle := site.GetPage "page" "docs/reference/command-line-tools-reference/feature-gates" -}}
{{- $thisFeatureGate := false -}}
{{- range $featureGatesBundle.Resources.ByType "page" -}}
{{- if eq .Title $id -}}
{{- if ne $thisFeatureGate false -}}
{{- errorf "[%s] Duplicate feature gate details found for %q (language code %q)" site.Language.Lang $id site.Language.Lang -}}
{{- end -}}
{{- $thisFeatureGate = . -}}
{{- end -}}
{{- end -}}
{{- if not $thisFeatureGate -}}
{{- errorf "[%s] Feature gate details not found for %q (language code %q)" site.Language.Lang $id site.Language.Lang -}}
{{- end -}}
{{- with $thisFeatureGate.Content -}}
<p><code>{{ $id }}</code>: {{ . | markdownify -}}</p>
{{- end -}}