Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d31a927

Browse files
committed
tpl: Run gotmplfmt -w .
1 parent 6a2a038 commit d31a927

29 files changed

Lines changed: 965 additions & 959 deletions
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{{ range $i, $e := .Scripts -}}
2-
{{ printf "import { %s as Script%d } from %q;" .Export $i .Import }}
2+
{{ printf "import { %s as Script%d } from %q;" .Export $i .Import }}
33
{{ end -}}
44
{{ range $i, $e := .Runners }}
5-
{{ printf "import { %s as Run%d } from %q;" .Export $i .Import }}
5+
{{ printf "import { %s as Run%d } from %q;" .Export $i .Import }}
66
{{ end }}
77
{{/* */}}
88
let scripts = [];
99
{{ range $i, $e := .Scripts -}}
10-
scripts.push({{ .RunnerJSON $i }});
10+
scripts.push({{ .RunnerJSON $i }});
1111
{{ end -}}
1212
{{/* */}}
1313
{{ range $i, $e := .Runners }}
14-
{{ $id := printf "Run%d" $i }}
15-
{{ $id }}(scripts);
14+
{{ $id := printf "Run%d" $i }}
15+
{{ $id }}(scripts);
1616
{{ end }}

tpl/tplimpl/embedded/templates/_markup/render-codeblock-goat.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
{{ $height := .Attributes.height }}
33
{{ $class := .Attributes.class | default "" }}
44
<div class="goat svg-container {{ $class }}">
5-
{{ with diagrams.Goat .Inner }}
6-
<svg
7-
xmlns="http://www.w3.org/2000/svg"
8-
font-family="Menlo,Lucida Console,monospace"
9-
{{ if or $width $height }}
10-
{{ with $width }}width="{{ . }}"{{ end }}
11-
{{ with $height }}height="{{ . }}"{{ end }}
12-
{{ else }}
13-
viewBox="0 0 {{ .Width }} {{ .Height }}"
14-
{{ end }}>
15-
{{ .Inner }}
16-
</svg>
17-
{{ end }}
5+
{{ with diagrams.Goat .Inner }}
6+
<svg
7+
xmlns="http://www.w3.org/2000/svg"
8+
font-family="Menlo,Lucida Console,monospace"
9+
{{ if or $width $height }}
10+
{{ with $width }}width="{{ . }}"{{ end }}
11+
{{ with $height }}height="{{ . }}"{{ end }}
12+
{{ else }}
13+
viewBox="0 0 {{ .Width }} {{ .Height }}"
14+
{{ end }}>
15+
{{ .Inner }}
16+
</svg>
17+
{{ end }}
1818
</div>
Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
{{- $u := urls.Parse .Destination -}}
22
{{- $src := $u.String -}}
33
{{- if not $u.IsAbs -}}
4-
{{- $path := strings.TrimPrefix "./" $u.Path -}}
5-
{{- with or (.PageInner.Resources.Get $path) (resources.Get $path) -}}
6-
{{- $src = .RelPermalink -}}
7-
{{- with $u.RawQuery -}}
8-
{{- $src = printf "%s?%s" $src . -}}
9-
{{- end -}}
10-
{{- with $u.Fragment -}}
11-
{{- $src = printf "%s#%s" $src . -}}
12-
{{- end -}}
13-
{{- end -}}
4+
{{- $path := strings.TrimPrefix "./" $u.Path -}}
5+
{{- with or (.PageInner.Resources.Get $path) (resources.Get $path) -}}
6+
{{- $src = .RelPermalink -}}
7+
{{- with $u.RawQuery -}}
8+
{{- $src = printf "%s?%s" $src . -}}
9+
{{- end -}}
10+
{{- with $u.Fragment -}}
11+
{{- $src = printf "%s#%s" $src . -}}
12+
{{- end -}}
13+
{{- end -}}
1414
{{- end -}}
1515
<img src="{{ $src }}" alt="{{ .PlainText }}"
16-
{{- with .Title }} title="{{ . }}" {{- end -}}
17-
{{- range $k, $v := .Attributes -}}
18-
{{- if $v -}}
19-
{{- printf " %s=%q" $k ($v | transform.HTMLEscape) | safeHTMLAttr -}}
20-
{{- end -}}
21-
{{- end -}}
22-
>
16+
{{- with .Title }} title="{{ . }}" {{- end -}}
17+
{{- range $k, $v := .Attributes -}}
18+
{{- if $v -}}
19+
{{- printf " %s=%q" $k ($v | transform.HTMLEscape) | safeHTMLAttr -}}
20+
{{- end -}}
21+
{{- end -}}>
2322
{{- /**/ -}}
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
{{- $u := urls.Parse .Destination -}}
22
{{- $href := $u.String -}}
33
{{- if strings.HasPrefix $u.String "#" -}}
4-
{{- $href = printf "%s#%s" .PageInner.RelPermalink $u.Fragment -}}
4+
{{- $href = printf "%s#%s" .PageInner.RelPermalink $u.Fragment -}}
55
{{- else if and $href (not $u.IsAbs) -}}
6-
{{- $path := strings.TrimPrefix "./" $u.Path -}}
7-
{{- with or
8-
($.PageInner.GetPage $path)
9-
($.PageInner.Resources.Get $path)
10-
(resources.Get $path)
11-
-}}
12-
{{- $href = .RelPermalink -}}
13-
{{- with $u.RawQuery -}}
14-
{{- $href = printf "%s?%s" $href . -}}
15-
{{- end -}}
16-
{{- with $u.Fragment -}}
17-
{{- $href = printf "%s#%s" $href . -}}
18-
{{- end -}}
19-
{{- end -}}
6+
{{- $path := strings.TrimPrefix "./" $u.Path -}}
7+
{{- with or
8+
($.PageInner.GetPage $path)
9+
($.PageInner.Resources.Get $path)
10+
(resources.Get $path)
11+
-}}
12+
{{- $href = .RelPermalink -}}
13+
{{- with $u.RawQuery -}}
14+
{{- $href = printf "%s?%s" $href . -}}
15+
{{- end -}}
16+
{{- with $u.Fragment -}}
17+
{{- $href = printf "%s#%s" $href . -}}
18+
{{- end -}}
19+
{{- end -}}
2020
{{- end -}}
2121
<a href="{{ $href }}" {{- with .Title }} title="{{ . }}" {{- end }}>{{ .Text }}</a>
2222
{{- /**/ -}}
Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
11
<table
2-
{{- range $k, $v := .Attributes }}
3-
{{- if $v }}
4-
{{- printf " %s=%q" $k ($v | transform.HTMLEscape) | safeHTMLAttr }}
5-
{{- end }}
6-
{{- end }}>
7-
<thead>
8-
{{- range .THead }}
9-
<tr>
10-
{{- range . }}
11-
<th
12-
{{- with .Alignment }}
13-
{{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }}
14-
{{- end -}}
15-
>
16-
{{- .Text -}}
17-
</th>
18-
{{- end }}
19-
</tr>
20-
{{- end }}
21-
</thead>
22-
<tbody>
23-
{{- range .TBody }}
24-
<tr>
25-
{{- range . }}
26-
<td
27-
{{- with .Alignment }}
28-
{{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }}
29-
{{- end -}}
30-
>
31-
{{- .Text -}}
32-
</td>
33-
{{- end }}
34-
</tr>
35-
{{- end }}
36-
</tbody>
2+
{{- range $k, $v := .Attributes }}
3+
{{- if $v }}
4+
{{- printf " %s=%q" $k ($v | transform.HTMLEscape) | safeHTMLAttr }}
5+
{{- end }}
6+
{{- end }}>
7+
<thead>
8+
{{- range .THead }}
9+
<tr>
10+
{{- range . }}
11+
<th
12+
{{- with .Alignment }}
13+
{{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }}
14+
{{- end -}}>
15+
{{- .Text -}}
16+
</th>
17+
{{- end }}
18+
</tr>
19+
{{- end }}
20+
</thead>
21+
<tbody>
22+
{{- range .TBody }}
23+
<tr>
24+
{{- range . }}
25+
<td
26+
{{- with .Alignment }}
27+
{{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }}
28+
{{- end -}}>
29+
{{- .Text -}}
30+
</td>
31+
{{- end }}
32+
</tr>
33+
{{- end }}
34+
</tbody>
3735
</table>

tpl/tplimpl/embedded/templates/_partials/_funcs/get-page-images.html

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,50 @@
33
{{- $resources := .Resources.ByType "image" -}}
44
{{/* Find featured image resources if the images parameter is empty. */}}
55
{{- if not $imgParams }}
6-
{{- $featured := $resources.GetMatch "*feature*" -}}
7-
{{- if not $featured }}{{ $featured = $resources.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
8-
{{- with $featured }}
9-
{{- $imgs = $imgs | append (dict
10-
"Image" .
11-
"RelPermalink" .RelPermalink
12-
"Permalink" .Permalink) }}
13-
{{- end }}
6+
{{- $featured := $resources.GetMatch "*feature*" -}}
7+
{{- if not $featured }}{{ $featured = $resources.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
8+
{{- with $featured }}
9+
{{- $imgs = $imgs | append (dict
10+
"Image" .
11+
"RelPermalink" .RelPermalink
12+
"Permalink" .Permalink
13+
)
14+
}}
15+
{{- end }}
1416
{{- end }}
1517
{{/* Use the first one of site images as the fallback. */}}
1618
{{- if and (not $imgParams) (not $imgs) }}
17-
{{- with site.Params.images }}
18-
{{- $imgParams = first 1 . }}
19-
{{- end }}
19+
{{- with site.Params.images }}
20+
{{- $imgParams = first 1 . }}
21+
{{- end }}
2022
{{- end }}
2123
{{/* Parse page's images parameter. */}}
2224
{{- range $imgParams }}
23-
{{- $img := . }}
24-
{{- $url := urls.Parse $img }}
25-
{{- if eq $url.Scheme "" }}
26-
{{/* Internal image: check page resources first, then global resources. */}}
27-
{{- with or ($resources.GetMatch $img) (resources.GetMatch $img) -}}
28-
{{- $imgs = $imgs | append (dict
29-
"Image" .
30-
"RelPermalink" .RelPermalink
31-
"Permalink" .Permalink) }}
32-
{{- else }}
33-
{{- $imgs = $imgs | append (dict
34-
"RelPermalink" (relURL $img)
35-
"Permalink" (absURL $img)
36-
) }}
37-
{{- end }}
38-
{{- else }}
39-
{{/* External image */}}
40-
{{- $imgs = $imgs | append (dict
41-
"RelPermalink" $img
42-
"Permalink" $img
43-
) }}
44-
{{- end }}
25+
{{- $img := . }}
26+
{{- $url := urls.Parse $img }}
27+
{{- if eq $url.Scheme "" }}
28+
{{/* Internal image: check page resources first, then global resources. */}}
29+
{{- with or ($resources.GetMatch $img) (resources.GetMatch $img) -}}
30+
{{- $imgs = $imgs | append (dict
31+
"Image" .
32+
"RelPermalink" .RelPermalink
33+
"Permalink" .Permalink
34+
)
35+
}}
36+
{{- else }}
37+
{{- $imgs = $imgs | append (dict
38+
"RelPermalink" (relURL $img)
39+
"Permalink" (absURL $img)
40+
)
41+
}}
42+
{{- end }}
43+
{{- else }}
44+
{{/* External image */}}
45+
{{- $imgs = $imgs | append (dict
46+
"RelPermalink" $img
47+
"Permalink" $img
48+
)
49+
}}
50+
{{- end }}
4551
{{- end }}
4652
{{- return $imgs }}

tpl/tplimpl/embedded/templates/_partials/disqus.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{- $pc := .Site.Config.Privacy.Disqus -}}
22
{{- if not $pc.Disable -}}
3-
{{ if .Site.Config.Services.Disqus.Shortname }}<div id="disqus_thread"></div>
3+
{{ if .Site.Config.Services.Disqus.Shortname }}<div id="disqus_thread"></div>
44
<script>
55
window.disqus_config = function () {
66
{{with .Params.disqus_identifier }}this.page.identifier = '{{ . }}';{{end}}
@@ -18,6 +18,7 @@
1818
(d.head || d.body).appendChild(s);
1919
})();
2020
</script>
21-
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
22-
<a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>{{end}}
21+
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
22+
<a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
23+
{{ end }}
2324
{{- end -}}

tpl/tplimpl/embedded/templates/_partials/google_analytics.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{{ if not site.Config.Privacy.GoogleAnalytics.Disable }}
2-
{{- with site.Config.Services.GoogleAnalytics.ID }}
3-
{{- if strings.HasPrefix (lower .) "ua-" }}
4-
{{- warnf "Google Analytics 4 (GA4) replaced Google Universal Analytics (UA) effective 1 July 2023. See https://support.google.com/analytics/answer/11583528. Create a GA4 property and data stream, then replace the Google Analytics ID in your project configuration with the new value." }}
5-
{{- else }}
2+
{{- with site.Config.Services.GoogleAnalytics.ID }}
3+
{{- if strings.HasPrefix (lower .) "ua-" }}
4+
{{- warnf "Google Analytics 4 (GA4) replaced Google Universal Analytics (UA) effective 1 July 2023. See https://support.google.com/analytics/answer/11583528. Create a GA4 property and data stream, then replace the Google Analytics ID in your project configuration with the new value." }}
5+
{{- else }}
66
<script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script>
77
<script>
88
var doNotTrack = false;
@@ -17,6 +17,6 @@
1717
gtag('config', '{{ . }}');
1818
}
1919
</script>
20-
{{- end }}
21-
{{- end }}
20+
{{- end }}
21+
{{- end }}
2222
{{- end -}}

0 commit comments

Comments
 (0)