Whitespace in templates.

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

View file

@ -11,7 +11,7 @@
{{ $realheight := 0 -}}
{{ $resource := false -}}
{{ $src := .Destination -}}
{{ $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,7 +48,7 @@
{{ if $srcset -}}
{{ range $set := split $srcset " " -}}
{{ $image := $resource.Resize (printf "%sx" $set) -}}
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $image.RelPermalink $set) }}
{{ $srcsetw = $srcsetw | append (printf "%s %sw" $image.RelPermalink $set) -}}
{{ end }}
{{ $width = "" -}}
{{ $height = "" -}}

View file

@ -30,7 +30,7 @@
{{ with .OutputFormats.Get "RSS" -}}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end -}}
{{ range $pages }}
{{ range $pages -}}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
@ -41,6 +41,6 @@
<guid>{{ .Permalink }}</guid>
<description>{{ .Content | html }}</description>
</item>
{{ end }}
{{ end -}}
</channel>
</rss>

View file

@ -17,4 +17,4 @@
</div>
</article>
</main>
{{ end }}
{{ end -}}

View file

@ -16,4 +16,4 @@
{{ partial "pagination.html" . }}
</main>
{{ end }}
{{ end -}}

View file

@ -16,4 +16,4 @@
{{ partial "pagination.html" . }}
</main>
{{ end }}
{{ end -}}

View file

@ -22,13 +22,13 @@
{{ with .OutputFormats.Get "RSS" -}}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end -}}
{{ range .Pages }}
{{ range .Pages -}}
<item>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<guid>{{ .Permalink }}</guid>
<description>{{ .Content | html }}</description>
</item>
{{ end }}
{{ end -}}
</channel>
</rss>

View file

@ -12,4 +12,4 @@
</div>
</article>
</main>
{{ end }}
{{ end -}}

View file

@ -5,12 +5,12 @@
</svg>
<ul class="navbar">
{{ if .IsTranslated -}}
{{ range .Translations }}
{{ range .Translations -}}
<li><a rel="alternate" href="{{ .RelPermalink }}" hreflang="{{ .Site.LanguageCode | default .Lang }}" lang="{{ .Site.LanguageCode | default .Lang }}">{{ .Language.LanguageName }}</a></li>
{{ end -}}
{{ else -}}
{{ range site.Languages -}}
{{ if ne site.Language.Lang .Lang }}
{{ if ne site.Language.Lang .Lang -}}
<li><a rel="alternate" href="{{ .Lang | relURL }}" hreflang="{{ .Lang }}" lang="{{ .Lang }}">{{ .LanguageName }}</a></li>
{{ end -}}
{{ end -}}

View file

@ -12,4 +12,4 @@
</div>
</article>
</main>
{{ end }}
{{ end -}}

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>