From 595325b5ad5b6039b1fe7925eb5f2c36b4d55602 Mon Sep 17 00:00:00 2001 From: Balakrishnan Balasubramanian Date: Mon, 26 May 2025 17:48:23 -0400 Subject: [PATCH] refactor asciinema --- layouts/_default/baseof.html | 12 ++++-------- layouts/_partials/asciinema/csp.html | 3 +++ layouts/_partials/asciinema/head.html | 8 ++++++++ layouts/_shortcodes/asciinema.html | 3 --- 4 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 layouts/_partials/asciinema/csp.html create mode 100644 layouts/_partials/asciinema/head.html diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index e4a7882..475708c 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -5,18 +5,14 @@ - + - {{ if .Params.asciinema }} - {{ with resources.Get "vendor/asciinema/asciinema-player.css" | minify | fingerprint }} - - {{ end }} - {{ end }} -{{- if isset .Site.Params "onionlocation" }} + {{ partial "asciinema/head" . }} +{{- if isset .Site.Params "onionlocation" -}} -{{- end }} +{{- end -}} {{ block "title" . }}{{ .Site.Title }}{{ end }} diff --git a/layouts/_partials/asciinema/csp.html b/layouts/_partials/asciinema/csp.html new file mode 100644 index 0000000..b64f40c --- /dev/null +++ b/layouts/_partials/asciinema/csp.html @@ -0,0 +1,3 @@ +{{- /* This renders as 'unsafe-eval' . This seems to be work fine +though. TODO: how to render as proper single quotes? */ -}} +{{- if .Params.asciinema -}}'unsafe-eval'{{- end -}} diff --git a/layouts/_partials/asciinema/head.html b/layouts/_partials/asciinema/head.html new file mode 100644 index 0000000..b112a56 --- /dev/null +++ b/layouts/_partials/asciinema/head.html @@ -0,0 +1,8 @@ +{{ if .Params.asciinema }} + {{ with resources.Get "vendor/asciinema/asciinema-player.css" | minify | fingerprint }} + + {{ end }} + {{ with resources.Get "vendor/asciinema/asciinema-player.min.js" | fingerprint }} + + {{ end }} +{{ end }} diff --git a/layouts/_shortcodes/asciinema.html b/layouts/_shortcodes/asciinema.html index ec6a778..9d096f3 100644 --- a/layouts/_shortcodes/asciinema.html +++ b/layouts/_shortcodes/asciinema.html @@ -1,7 +1,4 @@
-{{ with resources.Get "vendor/asciinema/asciinema-player.min.js" | fingerprint }} - -{{ end }}