mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-14 01:32:11 +00:00
29 lines
907 B
HTML
29 lines
907 B
HTML
{{ $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 strings.HasPrefix $k "str" -}}
|
|
{{- $after := printf `<strong>%s</strong>` $v -}}
|
|
{{- $contents = $contents | replaceRE $v $after -}}
|
|
{{- else if strings.HasPrefix $k "trans" -}}
|
|
{{- $after := printf `<span translate="yes">%s</span>` $v -}}
|
|
{{- $contents = $contents | replaceRE $v $after -}}
|
|
{{- else if and (eq $k "samp")}}
|
|
{{- $samp = $v -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
<pre tabindex="0">
|
|
{{- if $samp -}}
|
|
<samp translate="no" itemprop="text">
|
|
{{- $contents | safeHTML -}}
|
|
</samp>
|
|
{{- else -}}
|
|
<code translate="no" itemprop="text">
|
|
{{- $contents | safeHTML -}}
|
|
</code>
|
|
{{- end -}}
|
|
</pre>
|