]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Add a param shortcode to work around the escaped characters in hashes
authorRegis Philibert <login@regisphilibert.com>
Tue, 5 May 2020 18:49:12 +0000 (21:49 +0300)
committerXhmikosR <xhmikosr@gmail.com>
Thu, 7 May 2020 17:53:21 +0000 (20:53 +0300)
site/layouts/shortcodes/param.html [new file with mode: 0644]

diff --git a/site/layouts/shortcodes/param.html b/site/layouts/shortcodes/param.html
new file mode 100644 (file)
index 0000000..50e2060
--- /dev/null
@@ -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 -}}