Files

25 lines
1015 B
HTML

{{- 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>