Refactor to avoid excess spaces and newlines in output.

This commit is contained in:
2025-11-16 18:25:29 -07:00
parent 0471787ed5
commit 500eee955d

View File

@@ -1,19 +1,20 @@
{{ $src := .Get "src" | default (.Get 0) {{ $src := .Get "src" | default (.Get 0)
}} {{ $type := .Get "type" }}
}} {{ if and (isset .Params "type") (not (eq $type "")) {{ $type := .Get "type"
}} {{ .Scratch.Set "type" $type }}{{ if and (isset .Params "type") (not (eq $type ""))
}} {{ else }}{{ .Scratch.Set "type" $type
}} {{ $type := strings.TrimSuffix $src (path.Ext $src) }}{{ else
}} {{ $type := strings.TrimPrefix "." $type }}{{ $type := strings.TrimSuffix $src (path.Ext $src)
}} {{ .Scratch.Set "type" $type }}{{ $type := strings.TrimPrefix "." $type
}} {{ end }}{{ .Scratch.Set "type" $type
}}{{ end
}} }}
{{ $text := .Get "text" {{ $text := .Get "text"
}} {{ if and (isset .Params "text") (not (eq $text "")) }}{{ if and (isset .Params "text") (not (eq $text ""))
}} {{ .Scratch.Set "text" $text }}{{ .Scratch.Set "text" $text
}} {{ else }}{{ else
}} {{ .Scratch.Set "text" "Audio playback is not available on your browser." }}{{ .Scratch.Set "text" "Audio playback is not available on your browser."
}} {{ end }}{{ end
}} }}
<audio controls> <audio controls>
<source <source