{{- if ( and ( .Get "src" ) ( .Get "chart-id" ) ) -}} {{- errorf "Both chart ID and resource source defined" -}} {{- end -}} {{ $src := $.Page.Resources.GetMatch (.Get "src") }} {{ if ( not $src ) }} {{- errorf "No Page Resource found for src '%v' for post '%v'" ( .Get "src" ) $.File.Path -}} {{ end }} {{ $linkedResource := $.Page.Resources.GetMatch (.Get "link") }}
{{- with .Get "chart-id" -}} You must enable Javascript to view this chart. {{- else -}} {{- if .Get "link" -}} {{- if $linkedResource }} {{ else }} {{ end }} {{- end -}} {{- if eq $src.ResourceType "image" -}} {{ with $src.Params.alt }}{{ . }}{{ else }}{{ .Get {{- else if eq $src.ResourceType "video" -}} {{- if eq $src.MediaType "video/ogg" -}}

Your browser doesn't support embedded audio, but you can view the audio here.

{{- else -}} {{- end -}} {{- else if or ( ne $src.ResourceType "image" ) ( ne $src.ResourceType "video" ) -}} {{- errorf "No handling for resource of type %q" $src.ResourceType -}} {{- end -}} {{- if .Get "link" }}{{ end -}} {{- end -}} {{- if or ( .Get "caption" ) ( .Get "title" ) ( $src.Params.attr ) -}}
{{- with $src -}} {{ if .Params.attrlink -}} {{- end -}} {{- if .Params.attr -}}

{{ .Params.attr | safeHTML }}{{ with .Params.attrlicence }} {{ . | safeHTML }}{{ end }}

{{- end -}} {{- if .Params.attrlink -}}
{{- end -}} {{- with .Params.title -}}

{{ . }}

{{- end -}} {{- end -}} {{- with .Get "title" -}}

{{ . }}

{{- end -}} {{- with .Get "caption" -}}

{{ . | markdownify }}

{{- end -}}
{{- end -}}