17 lines
736 B
HTML

{{- $key := .Get "key" -}}
{{- /* Doc: https://docs.asciinema.org/manual/player/options/ */ -}}
{{- $opts := slice "cols" "rows" "autoPlay" "preload" "loop" "startAt" "speed"
"idleTimeLimit" "theme" "poster" "fit" "controls" "pauseOnMarkers"
"terminalFontSize" "terminalFontFamily" "terminalLineHeight" -}}
{{- /* Skipping option markers. It is an array. Not sure if possible to pass in
hugo. Embed directly in cast file */ -}}
<div id='{{ $key }}_asciinema_cast'></div>
<script>
AsciinemaPlayer.create('casts/{{ $key }}.cast', document.getElementById('{{ $key }}_asciinema_cast'), {
{{- range $opts }}
{{- $opt := . -}}
{{- with $.Get $opt }}{{ $opt }}: "{{ . }}",{{- end -}}
{{- end -}}
});
</script>