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