{{- $id := .Get "term_id" -}} {{- $text := .Get "text" -}} {{- partial "docs/glossary-terms.html" $.Page -}} {{- $glossary_items := $.Page.Scratch.Get "glossary_items" -}} {{- if not $glossary_items -}} {{- errorf "[%s] No glossary items found" site.Language.Lang -}} {{- else -}} {{- $term_info := $glossary_items.GetMatch (printf "%s.md" $id ) -}} {{- if not $term_info -}} {{- errorf "[%s] %q: %q is not a valid glossary term_id, see ./docs/reference/glossary/* for a full list" site.Language.Lang .Page.Path $id -}} {{- end }} {{- with $term_info -}} {{- $text := $text | default $term_info.Title -}} {{- $glossary_home := "docs/reference/glossary/?all=true" | relLangURL -}} {{- $external_link := $term_info.Params.full_link | default (printf "%s#term-%s" $glossary_home $id | safeURL ) -}} {{- $tooltip := $term_info.Params.short_description | markdownify -}} {{- $tooltip := $tooltip | replaceRE "(?s)(.*?).*" "$1" | plainify -}} {{- $tooltip := trim $tooltip " \n" -}} {{- $text -}} {{- end -}} {{- end -}}