mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-23 21:02:09 +00:00
14 lines
551 B
HTML
14 lines
551 B
HTML
{{- $codeIndex := (.Page.Scratch.Get "codeIndex") -}}
|
|
{{- $id := (printf `code-%d` $codeIndex) -}}
|
|
{{ with .Parent }}
|
|
{{- with .Get "id" -}}
|
|
{{- $id = . -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
<figcaption id="{{ $id }}-caption">
|
|
<span id="{{ $id }}">
|
|
<strong itemprop="name"> <span itemprop="codeSampleType">Code snippet</span> {{ $codeIndex }}</strong>{{with .Get "lang"}} (<span itemprop="programmingLanguage">{{ . }}</span>){{ end -}}
|
|
</span>:
|
|
{{ .Inner | markdownify | safeHTML }}
|
|
</figcaption>
|
|
{{- .Page.Scratch.Set "codeIndex" (add 1 $codeIndex) -}}
|