1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-12-26 18:32:10 +00:00
seirdy.one/layouts/_default/_markup/render-codeblock-figure.html

24 lines
535 B
HTML
Raw Normal View History

{{ $contents := .Inner | htmlEscape }}
{{ $samp := false }}
{{ with .Attributes }}
{{ range $k, $v := . }}
{{ if strings.HasPrefix $k "var" }}
{{ $after := printf `<var translate="yes">%s</var>` $v }}
{{ $contents = $contents | replaceRE $v $after }}
{{ else if and (eq $k "samp")}}
{{ $samp = $v }}
{{ end }}
{{ end }}
{{ end }}
<pre tabindex="0">
{{- if $samp -}}
<samp itemprop="text">
{{- $contents | safeHTML -}}
</samp>
{{- else -}}
<code itemprop="text">
{{- $contents | safeHTML -}}
</code>
{{- end -}}
</pre>