2018-05-05 16:00:51 +00:00
|
|
|
{{- $id := .Get "term_id" -}}
|
|
|
|
{{- $text := .Get "text" -}}
|
2018-10-01 19:38:37 +00:00
|
|
|
{{- partial "docs/glossary-terms.html" $.Page -}}
|
|
|
|
{{- $glossary_items := $.Page.Scratch.Get "glossary_items" -}}
|
|
|
|
{{- if not $glossary_items -}}
|
2019-02-05 16:33:23 +00:00
|
|
|
{{- errorf "[%s] No glossary items found" site.Language.Lang -}}
|
2018-10-01 19:38:37 +00:00
|
|
|
{{- else -}}
|
2019-05-08 20:18:36 +00:00
|
|
|
{{- $term_info := $glossary_items.GetMatch (printf "%s.md" $id ) -}}
|
2018-05-05 16:00:51 +00:00
|
|
|
{{- if not $term_info -}}
|
2019-02-05 16:33:23 +00:00
|
|
|
{{- 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 -}}
|
2018-05-05 16:00:51 +00:00
|
|
|
{{- 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 -}}
|
2020-10-05 16:01:39 +00:00
|
|
|
|
|
|
|
{{- $tooltip := $tooltip | replaceRE "(?s)<a class='glossary-tooltip'.*?>(.*?).*</a>" "$1" | plainify -}}
|
2018-05-05 16:00:51 +00:00
|
|
|
{{- $tooltip := trim $tooltip " \n" -}}
|
2020-10-05 16:01:39 +00:00
|
|
|
<a class='glossary-tooltip' title='{{- $tooltip | safeHTML -}}' data-toggle='tooltip' data-placement='top' href='{{ $external_link }}' target='_blank' aria-label='{{ $text }}'>
|
|
|
|
{{- $text -}}
|
2018-05-05 16:00:51 +00:00
|
|
|
</a>
|
2018-10-01 19:38:37 +00:00
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|