Whitespace in templates.

This commit is contained in:
Fredrik Jonsson 2023-05-28 19:36:58 +02:00
commit 9bdec6ca76
5 changed files with 30 additions and 26 deletions

View file

@ -35,5 +35,7 @@
<audio controls preload="{{ $preload }}">
<source src="{{ $src }}" {{ with $type }}type="{{ . }}"{{ end }}>
</audio>
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
{{ with $caption -}}
<figcaption>{{ . | markdownify }}</figcaption>
{{ end -}}
</figure>

View file

@ -15,7 +15,7 @@
{{ $realwidth := 0 -}}
{{ $realheight := 0 -}}
{{ $resource := false -}}
{{ $srcsetw := (slice) }}
{{ $srcsetw := (slice) -}}
{{ $static := false -}}
{{ if and $src (fileExists (path.Join "/static" $src)) -}}
@ -42,7 +42,7 @@
{{ $width = $image.Width -}}
{{ $height = $image.Height -}}
{{ if $srcset -}}
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $src (strings.TrimRight "x" $size)) }}
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $src (strings.TrimRight "x" $size)) -}}
{{ end -}}
{{ else -}}
{{ $src = $resource.RelPermalink -}}
@ -52,8 +52,8 @@
{{ if $srcset -}}
{{ range $set := split $srcset " " -}}
{{ $image := $resource.Resize (printf "%sx" $set) -}}
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $image.RelPermalink $set) }}
{{ end }}
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $image.RelPermalink $set) -}}
{{ end -}}
{{ $width = "" -}}
{{ $height = "" -}}
{{ end -}}

View file

@ -11,7 +11,7 @@
{{ $realwidth := 0 -}}
{{ $realheight := 0 -}}
{{ $resource := false -}}
{{ $srcsetw := (slice) }}
{{ $srcsetw := (slice) -}}
{{ $static := false -}}
{{ if and $src (fileExists (path.Join "/static" $src)) -}}
@ -38,7 +38,7 @@
{{ $width = $image.Width -}}
{{ $height = $image.Height -}}
{{ if $srcset -}}
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $src (strings.TrimRight "x" $size)) }}
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $src (strings.TrimRight "x" $size)) -}}
{{ end -}}
{{ else -}}
{{ $src = $resource.RelPermalink -}}
@ -48,8 +48,8 @@
{{ if $srcset -}}
{{ range $set := split $srcset " " -}}
{{ $image := $resource.Resize (printf "%sx" $set) -}}
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $image.RelPermalink $set) }}
{{ end }}
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $image.RelPermalink $set) -}}
{{ end -}}
{{ $width = "" -}}
{{ $height = "" -}}
{{ end -}}

View file

@ -13,7 +13,7 @@
{{ if and $src (fileExists (path.Join "/static" $src)) -}}
{{ $static = true -}}
{{ $src = relURL $src -}}
{{ if $inline }}
{{ if $inline -}}
{{ $src = readFile (path.Join "/static" $src) -}}
{{ end -}}
{{ else if $src -}}

View file

@ -27,7 +27,7 @@
{{ if $resource -}}
{{ $src = $resource.RelPermalink -}}
{{ $type = $resource.MediaType }}
{{ $type = $resource.MediaType -}}
{{ end -}}
{{ if and $poster (fileExists (path.Join "/static" $poster)) -}}
@ -61,5 +61,7 @@
<video controls preload="{{ $preload }}" {{ with $width }}width="{{ . }}"{{ end }} {{ with $poster }}poster="{{ . }}"{{ end }} {{ with $autoplay }}autoplay="{{ . }}"{{ end }} {{ with $loop }}loop="{{ . }}"{{ end }}>
<source src="{{ $src }}" {{ with $type }}type="{{ . }}"{{ end }}>
</video>
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
{{ with $caption -}}
<figcaption>{{ . | markdownify }}</figcaption>
{{ end -}}
</figure>