2024-01-30 17:44:23 -05:00
|
|
|
{{- .Page.Scratch.Add "codeIndex" 1 -}}
|
|
|
|
{{- $codeIndex := (int (.Page.Scratch.Get "codeIndex")) -}}
|
2022-04-20 17:56:06 -07:00
|
|
|
{{- $id := (printf `code-%d` $codeIndex) -}}
|
2022-04-21 21:40:40 -07:00
|
|
|
{{- with .Get "id" -}}
|
|
|
|
{{- $id = . -}}
|
|
|
|
{{- end -}}
|
2022-04-20 17:56:06 -07:00
|
|
|
{{ with .Parent }}
|
|
|
|
{{- with .Get "id" -}}
|
|
|
|
{{- $id = . -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
<figcaption id="{{ $id }}-caption">
|
2022-05-19 17:18:14 -07:00
|
|
|
<span id="{{ $id }}" tabindex="-1">
|
2022-04-20 17:56:06 -07:00
|
|
|
<strong itemprop="name"> <span itemprop="codeSampleType">Code snippet</span> {{ $codeIndex }}</strong>{{with .Get "lang"}} (<span itemprop="programmingLanguage">{{ . }}</span>){{ end -}}
|
|
|
|
</span>:
|
2023-11-10 10:01:59 -08:00
|
|
|
{{ .Inner | .Page.RenderString | safeHTML }}
|
2022-04-19 18:06:57 -07:00
|
|
|
</figcaption>
|