Files

33 lines
760 B
HTML
Raw Permalink Normal View History

{{- /*
Highlight a glossary term
@param {string} entry Either the glossary abbreviation or the term.
or
@param {string} 0 Either the glossary abbreviation or the term.
@example {{< term entry="MAC" >}}
@example {{< term "MAC" >}}
*/ -}}
{{- $entry := .Get "entry" | default (.Get 0) -}}
{{- $entryLower := lower $entry -}}
{{- $match := dict -}}
<!-- Go over the term data file - data/<lang>/termbase.yaml -->
{{- range (index .Site.Data .Site.Language.Lang "termbase") -}}
{{- if or (eq (lower .abbr) $entryLower) (eq (lower .term) $entryLower) -}}
{{- $match = . -}}
{{- break -}}
{{- end -}}
{{- end -}}
{{- with $match }}
<abbr title="{{ .definition | plainify }}">
{{- $entry -}}
</abbr>
{{- else }}
{{- $entry -}}
{{- end }}