Correctly replace the name for svgs

This commit is contained in:
BBaoVanC 2021-10-09 19:31:38 -05:00
parent 7f3d3f3dca
commit 9bb2b0c41c
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A

View File

@ -1,5 +1,5 @@
{{ $icon_resource := resources.Get (printf "feather/icons/%s.svg" .) }} {{ $icon_resource := resources.Get (printf "feather/icons/%s.svg" .) }}
{{ $icon := $icon_resource.Content }} {{ $icon := $icon_resource.Content }}
{{ $icon = replaceRE `<svg` `<svg class="icon"` $icon }} {{ $icon = replaceRE `<svg` `<svg class="icon"` $icon }}
{{ $icon = replaceRE `</svg>` `<title>{{ . }} icon</title></svg>` $icon }} {{ $icon = replaceRE `</svg>` (printf `<title>%s icon</title></svg>` .) $icon }}
{{ $icon | safeHTML }} {{ $icon | safeHTML }}