From: Regis Philibert Date: Tue, 5 May 2020 18:49:12 +0000 (+0300) Subject: Add a param shortcode to work around the escaped characters in hashes X-Git-Tag: v5.0.0-alpha1~137 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9793078331a338c605edff963b54135c836b940;p=thirdparty%2Fbootstrap.git Add a param shortcode to work around the escaped characters in hashes --- diff --git a/site/layouts/shortcodes/param.html b/site/layouts/shortcodes/param.html new file mode 100644 index 0000000000..50e2060ae2 --- /dev/null +++ b/site/layouts/shortcodes/param.html @@ -0,0 +1,12 @@ +{{- /* + Work around wrong escapes in integrity attributes. +*/ -}} + +{{- $name := .Get 0 -}} +{{- with $name -}} +{{- $value := $.Page.Param . -}} +{{- if in $name "_hash" -}} + {{- $value = $value | safeHTML -}} +{{- end -}} +{{- with $value }}{{ . }}{{ else }}{{ errorf "Param %q not found: %s" $name $.Position }}{{ end -}} +{{- else }}{{ errorf "Missing param key: %s" $.Position }}{{ end -}}