huge upgrade to theme and pagefind search bar.
This commit is contained in:
24
themes/hugo-book.backup/layouts/_shortcodes/asciinema.html
Normal file
24
themes/hugo-book.backup/layouts/_shortcodes/asciinema.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{{- if not (.Page.Store.Get "asciinema") -}}
|
||||
{{- /* Include asciinema player only first time */ -}}
|
||||
<link rel="stylesheet" href="{{ "asciinema/asciinema-player.css" | relURL }}" />
|
||||
{{- /* remove whitespaces */ -}}
|
||||
<script defer src="{{ "asciinema/asciinema-player.min.js" | relURL }}"></script>
|
||||
{{- /* remove whitespaces */ -}}
|
||||
<script defer src="{{ "asciinema/asciinema-auto.js" | relURL }}"></script>
|
||||
{{- .Page.Store.Set "asciinema" true -}}
|
||||
{{- end -}}
|
||||
{{- $href := (partial "docs/links/portable-image" (dict "Page" .Page "Destination" (.Get "cast"))) -}}
|
||||
{{- .Store.Set "asciinema" .Params -}}
|
||||
{{- .Store.DeleteInMap "asciinema" "cast" -}}
|
||||
{{- $attributes := partial "docs/text/mapper" (dict
|
||||
"attributes" (dict)
|
||||
"set" (dict
|
||||
"id" (printf "asciinema-%d" .Ordinal)
|
||||
"x-data-cast" $href
|
||||
"x-data-opts" (.Store.Get "asciinema" | jsonify)
|
||||
)
|
||||
"merge" (dict
|
||||
"class" (slice "asciinema" "book-asciinema")
|
||||
)
|
||||
) -}}
|
||||
<div {{ partial "docs/html-attrs" $attributes | safeHTMLAttr }}></div>
|
||||
Reference in New Issue
Block a user