2022-04-21 00:56:06 +00:00
|
|
|
{{- $codeIndex := (.Page.Scratch.Get "codeIndex") -}}
|
|
|
|
{{- $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>:
|
2022-04-20 01:06:57 +00:00
|
|
|
{{ .Inner | markdownify | safeHTML }}
|
|
|
|
</figcaption>
|
|
|
|
{{- .Page.Scratch.Set "codeIndex" (add 1 $codeIndex) -}}
|