mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
12 lines
579 B
HTML
12 lines
579 B
HTML
{{- /* Code copy button for no-classic mode code blocks */ -}}
|
|
{{- $config := .Config -}}
|
|
{{- $wrapper := .Wrapper -}}
|
|
|
|
{{- if $config.copyable -}}
|
|
{{- $copyIcon := dict "Class" "fa-regular fa-clone fa-width-auto" | partial "plugin/icon.html" -}}
|
|
{{- $copyBtn := printf `<button type="button" class="code-copy-btn" aria-label="%s" title="%s">%s</button>` (T "assets.copyToClipboard") (T "assets.copyToClipboard") $copyIcon -}}
|
|
{{- $wrapper = replaceRE `(<div class="code-wrapper">[\s\S]*?<\/div>)` (printf `$1%s` $copyBtn) $wrapper -}}
|
|
{{- end -}}
|
|
|
|
{{- return $wrapper -}}
|