{{- $page := . -}}
{{- $html := $page.Content -}}

{{- $items := site.Data.tooltips.items -}}

{{/* 1: placeholders zetten */}}
{{- range $name, $cfg := $items }}
  {{- $label := $cfg.label -}}
  {{- $placeholder := printf "__TOOLTIP_%s__" $name -}}
  {{- $pattern := printf `\b%s\b` $label -}}
  {{- $html = replaceRE $pattern $placeholder $html -}}
{{- end }}

{{/* 2: placeholders vervangen door tooltip-woord */}}
{{- range $name, $cfg := $items }}
  {{- $label := $cfg.label -}}
  {{- $key := $cfg.key -}}
  {{- $text := i18n $key -}}
  {{- $placeholder := printf "__TOOLTIP_%s__" $name -}}

  {{- $replacement := printf `<span class="tooltip-word" data-tooltip="%s">%s</span>` $text $label -}}

  {{- $html = replace $html $placeholder $replacement -}}
{{- end }}

{{- $html | safeHTML -}}
