mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-12-24 17:52:11 +00:00
16 lines
607 B
HTML
16 lines
607 B
HTML
{{- $codeIndex := (.Page.Scratch.Get "codeIndex") -}}
|
|
{{- $id := (printf `code-%d` $codeIndex) -}}
|
|
{{- with .Get "id" -}}
|
|
{{- $id = . -}}
|
|
{{- end -}}
|
|
<!--
|
|
The full caption is too long for an aria-label;
|
|
just use the beginning for the label and the full thing for the aria description.
|
|
-->
|
|
<figure aria-labelledby="{{ $id }}" itemprop="hasPart" itemscope="" itemtype="https://schema.org/SoftwareSourceCode">
|
|
{{ if .Get "samp" -}}
|
|
{{ .Inner | .Page.RenderString | replaceRE "<code" "<samp" | replaceRE "</code>" "</samp>" | safeHTML -}}
|
|
{{- else -}}
|
|
{{ .Inner | .Page.RenderString -}}
|
|
{{- end }}
|
|
</figure>
|