frostfs.info/layouts/shortcodes/term.html
Mikhail Petrov 5807c420af [#1] Implement initial doc site
Signed-off-by: Mikhail Petrov <m.petrov@yadro.com>
2022-12-29 15:35:27 +03:00

28 lines
972 B
HTML

{{ .Page.Scratch.Set "needPopper" true }}
{{- $styles := resources.Get "sass/term.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint -}}
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen">
{{- $position := .Position }}
{{- $term := .Inner -}}
{{- $gloss_entry := $term -}}
{{- if .Get 0 -}}
{{- $gloss_entry = .Get 0 -}}
{{- end -}}
{{- $glossary := .Site.GetPage "/concepts/glossary" -}}
{{- $words := $glossary.Resources.ByType "page" -}}
{{- $dfn := "" -}}
{{- $title := $term -}}
{{- range $w := $words -}}
{{- if (eq (upper $w.Title) (upper $gloss_entry)) -}}
{{- $dfn = $w.Content -}}
{{- $title = $w.Title -}}
{{- end -}}
{{- end -}}
{{- if (eq $dfn "") -}}
{{- errorf "Could not find glossary entry for '%s' (%s)" $gloss_entry $position -}}
{{- end -}}
<span class="term" data-title="{{- $title }}" data-body="{{- $dfn | string -}}">{{ $term }}</span>