mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
fe129dd207
* docs: improve error message clarity for shortcode parent block validation * feat: add APlayer shortcode and audio support * feat: support both APlayer and MetingJS * feat: initialize APlayer when content decrypted
24 lines
1.6 KiB
HTML
24 lines
1.6 KiB
HTML
{{- if .IsNamedParams -}}
|
|
{{- $options := dict -}}
|
|
{{- with .Get "fixed" -}}{{- $options = dict "fixed" . | merge $options -}}{{- end -}}
|
|
{{- with .Get "mini" -}}{{- $options = dict "mini" . | merge $options -}}{{- end -}}
|
|
{{- with .Get "autoplay" -}}{{- $options = dict "autoplay" . | merge $options -}}{{- end -}}
|
|
{{- with .Get "theme" -}}{{- $options = dict "theme" . | merge $options -}}{{- end -}}
|
|
{{- with .Get "loop" -}}{{- $options = dict "loop" . | merge $options -}}{{- end -}}
|
|
{{- with .Get "order" -}}{{- $options = dict "order" . | merge $options -}}{{- end -}}
|
|
{{- with .Get "preload" -}}{{- $options = dict "preload" . | merge $options -}}{{- end -}}
|
|
{{- with .Get "volume" -}}{{- $options = dict "volume" . | merge $options -}}{{- end -}}
|
|
{{- with .Get "mutex" -}}{{- $options = dict "mutex" . | merge $options -}}{{- end -}}
|
|
{{- with .Get "lrcType" -}}{{- $options = dict "lrcType" . | merge $options -}}{{- end -}}
|
|
{{- with .Get "listFolded" -}}{{- $options = dict "listFolded" . | merge $options -}}{{- end -}}
|
|
{{- with .Get "listMaxHeight" -}}{{- $options = dict "listMaxHeight" . | merge $options -}}{{- end -}}
|
|
{{- with .Get "storageName" -}}{{- $options = dict "storageName" . | merge $options -}}{{- end -}}
|
|
{{- $options = $options | jsonify -}}
|
|
{{- $audio := trim .Inner " \r\n" -}}
|
|
{{- $audio = replace $audio "}" "}," | printf "[%s]" -}}
|
|
{{- $audio = replace $audio ",]" "]" -}}
|
|
<div class="aplayer-shortcode" data-audio="{{ $audio }}" data-options="{{ $options }}"></div>
|
|
{{- else -}}
|
|
{{- errorf "Only named params is supported: %s" .Position -}}
|
|
{{- end -}}
|