{{- /* text-snippet.html (shortcode): Renders centered text content provided within the shortcode. Best used for short text blocks like introductions or as a text separator between sections. Target: Global. Example: {{< text-snippet TITLE="" >}} /... Markdown .../ {{< /text-snippet >}} Params: TITLE (string, optional):

heading. Error handler: - warnf - OCD Docs: https://alpha.oxypteros.com/shortcodes/text-snippet Repo: https://github.com/oxypteros/alpha */ -}} {{- /* Case-insensitive parameter retrieval (default chaining) */}} {{- $title := .Get "TITLE" | default (.Get "Title") | default (.Get "title") }} {{- $content := .Inner | markdownify }} {{- /* Context for error reporting (warnf, OCD)*/}} {{ $page := .Page.RelPermalink }} {{- /* OCD: Validate params manually against an allowlist. */}} {{- $allowedKeys := slice "title" }} {{- $invalidKeys := slice }} {{- /* Invalid Parameter Error Handling (OCD) */}} {{- /* NOTE: Not closed shortcode error is handled by Hugo */}} {{- range $key, $value := .Params }} {{- if not (in $allowedKeys (lower $key)) }} {{- $invalidKeys = $invalidKeys | append $key }} {{- end }} {{- end }} {{- if gt (len $invalidKeys) 0 }} {{- /* Warnf for error: ocd-sc-111 */}} {{- $errorCode := "ocd-sc-111" }} {{- $invalidKeysString := delimit $invalidKeys ", " }} {{- $errorMessage := printf "Invalid parameters: %s" $invalidKeysString }} {{- $logMessage := printf "OcdError [%s] Page: %s | %s" $errorCode $page $errorMessage }} {{- warnf "%s" $logMessage }} {{- /* OCD error card for: ocd-sc-111 */}} {{- if and (eq hugo.Environment "development") (hugo.IsServer) (eq .Page.Site.Params.ocd_enabled true) }}
{{- i18n "OcdScParamError" . | default "Shortcode Parameter Error" }}

{{- $count := len $invalidKeys }} {{- i18n "OcdScTextSnippet111" $count | default "Invalid parameter in the text snippet shortcode on this page:" }} {{ .Page.Title }}

{{- i18n "OcdScParameter" $count | default "The parameters," }}  {{ $invalidKeysString }}  {{ i18n "OcdScNotRecognized" $count | default "are not recognized." }}


{{ i18n "OcdScAcceptedParameters" . | default "Accepted parameters:" }} TITLE

{{- end }} {{- end }} {{- /* Shortcode Rendering */}}
{{- with $title }}

{{- $title -}}

{{- end }}
{{ $content }}