Skip to content

Commit 7ba6945

Browse files
committed
Run npx prettier --write layouts/**/*.html
1 parent 2b9b50b commit 7ba6945

File tree

9 files changed

+136
-81
lines changed

9 files changed

+136
-81
lines changed

‎layouts/404.html‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
{{define "main"}}
2-
<h2>Page Not Found!</h2>
3-
{{end}}
1+
{{ define "main" }}
2+
<h2>Page Not Found!</h2>
3+
{{ end }}

‎layouts/_default/_markup/render-heading.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
{{ end }}
1313
{{ $s.SetInMap "anchors" $anchor true }}
1414
{{ $h := printf "<h%d id=%q>%s</h%d>" .Level $anchor .Text .Level }}
15-
{{ $h | safeHTML }}
15+
{{ $h | safeHTML }}

‎layouts/_default/baseof.html‎

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html lang="{{ .Lang | default "en" }}">
33
<head>
4-
<meta charset="utf-8">
5-
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
6-
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
4+
<meta charset="utf-8" />
5+
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
6+
<meta
7+
name="viewport"
8+
content="width=device-width, initial-scale=1, maximum-scale=1" />
79
<title>
810
{{ .Title }}
911
</title>
@@ -12,24 +14,36 @@
1214
{{ partial "hook_head_end.html" . }}
1315
<style>
1416
[x-cloak] {
15-
display: none !important;
17+
display: none !important;
1618
}
1719
</style>
1820
</head>
1921
<body class="index" x-data="{ navOpen: false }" x-cloak>
20-
<a href="#" id="nav-button" @click="navOpen = !navOpen" :class="{'open': navOpen }">
22+
<a
23+
href="#"
24+
id="nav-button"
25+
@click="navOpen = !navOpen"
26+
:class="{'open': navOpen }">
2127
<span>
2228
NAV
23-
<img src='{{ relURL "images/navbar.png" }}'/>
29+
<img src="{{ relURL "images/navbar.png" }}" />
2430
</span>
2531
</a>
2632
<div class="toc-wrapper" :class="{'open': navOpen }">
2733
{{ partial "hook_left_sidebar_start.html" . }}
2834
{{ partial "hook_left_sidebar_logo.html" . }}
2935
{{ if .Site.Params.search }}
3036
<div class="search" x-data="searchController">
31-
<input x-model.debounce.100ms="query" type="search" class="search" id="input-search" placeholder='{{ T "search" . }}'>
32-
<ul class="search-results visible" x-show="results.length > 0" x-transition.duration.700ms >
37+
<input
38+
x-model.debounce.100ms="query"
39+
type="search"
40+
class="search"
41+
id="input-search"
42+
placeholder="{{ T "search" . }}" />
43+
<ul
44+
class="search-results visible"
45+
x-show="results.length > 0"
46+
x-transition.duration.700ms>
3347
<template x-for="item in results">
3448
<li>
3549
<a x-text="item.title"></a>
@@ -53,23 +67,29 @@
5367
<li>
5468
{{ . | markdownify }}
5569
</li>
56-
{{ end}}
70+
{{ end }}
5771
</ul>
58-
{{ end}}
72+
{{ end }}
5973
{{ partial "hook_left_sidebar_end.html" . }}
6074
</div>
6175
<div class="page-wrapper">
6276
<div class="dark-box"></div>
6377
<div class="content">
64-
{{block "main" .}}
78+
{{ block "main" . }}
6579
This is the main content.
66-
{{end}}
80+
{{ end }}
6781
</div>
6882
<div class="dark-box">
6983
{{ with .Site.Params.language_tabs }}
70-
<div class="lang-selector" x-data="langController" x-init="initLangs({{ . | jsonify }})">
84+
<div
85+
class="lang-selector"
86+
x-data="langController"
87+
x-init="initLangs({{ . | jsonify }})">
7188
<template x-for="(tab, index) in tabs">
72-
<a x-text="tab.name" :class="{ 'active': tab.active }" @click="changeLanguage(index)"></a>
89+
<a
90+
x-text="tab.name"
91+
:class="{ 'active': tab.active }"
92+
@click="changeLanguage(index)"></a>
7393
</template>
7494
</div>
7595
{{ end }}

‎layouts/_default/list.html‎

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,47 @@
99

1010
{{ define "toc" }}
1111
{{ $headers := slice }}
12-
{{ with .Site.RegularPages }}
12+
{{ with .Site.RegularPages }}
1313
{{ $headers = partial "funcs/toc_from_pages" . }}
1414
{{ end }}
15-
<ul id="toc" class="toc-list-h1" x-data="tocController" x-init="load({{ $headers | jsonify }})" @scroll.window="onScroll()">
15+
<ul
16+
id="toc"
17+
class="toc-list-h1"
18+
x-data="tocController"
19+
x-init="load({{ $headers | jsonify }})"
20+
@scroll.window="onScroll()">
1621
{{ $maxDepth := $.Site.Params.maxMenuDepth | default 2 }}
1722
<template x-for="row in rows">
1823
<li>
19-
<a x-text="row.title" @click="click(row)" :href="`#${row.id}`" class="toc-link" x-bind="rowClass(row)"></a>
20-
{{ if (ge $maxDepth 2) }}
24+
<a
25+
x-text="row.title"
26+
@click="click(row)"
27+
:href="`#${row.id}`"
28+
class="toc-link"
29+
x-bind="rowClass(row)"></a>
30+
{{ if (ge $maxDepth 2) }}
2131
<ul x-show="row.open" x-bind="transitions()" class="da-toc-list-h2">
2232
<template x-for="row in row.sub">
2333
<li>
24-
<a x-text="row.title" @click="click(row)" :href="`#${row.id}`" class="toc-link" x-bind="rowClass(row)"></a>
25-
{{ if (ge $maxDepth 3) }}
26-
<ul x-show="row.open" x-bind="transitions()" class="toc-list-h3">
34+
<a
35+
x-text="row.title"
36+
@click="click(row)"
37+
:href="`#${row.id}`"
38+
class="toc-link"
39+
x-bind="rowClass(row)"></a>
40+
{{ if (ge $maxDepth 3) }}
41+
<ul
42+
x-show="row.open"
43+
x-bind="transitions()"
44+
class="toc-list-h3">
2745
<template x-for="row in row.sub">
2846
<li>
29-
<a x-text="row.title" @click="click(row)" :href="`#${row.id}`" class="toc-link" x-bind="rowClass(row)"></a>
47+
<a
48+
x-text="row.title"
49+
@click="click(row)"
50+
:href="`#${row.id}`"
51+
class="toc-link"
52+
x-bind="rowClass(row)"></a>
3053
</li>
3154
</template>
3255
</ul>
Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,63 @@
11
{{ $combined := slice }}
22
{{ range . }}
3-
{{ $headers := findRE "<h\\d.*?>(.|\n)*?</h\\d>" .Content }}
4-
{{ $combined = $combined | append $headers }}
3+
{{ $headers := findRE "<h\\d.*?>(.|\n)*?</h\\d>" .Content }}
4+
{{ $combined = $combined | append $headers }}
55
{{ end }}
66

77
{{ $toc := slice }}
88

9-
{{ $previousH1 := dict}}
10-
{{ $previousH2 := dict}}
9+
{{ $previousH1 := dict }}
10+
{{ $previousH2 := dict }}
1111
{{ $previousLevel := 0 }}
1212

1313
{{ $h2s := slice }}
1414
{{ $h3s := slice }}
1515

1616
{{ range $combined }}
17-
{{ $level := int (substr . 2 1) }}
18-
{{ if le $level 3 }}
19-
{{ $idTitle := split (. | replaceRE "<h\\d id=\"(.*?)\">(.*)</h\\d>" "$1|$2") "|" }}
20-
{{ $item := dict "level" $level "id" (index $idTitle 0) "title" (index $idTitle 1) }}
21-
22-
{{ if eq $level 1 }}
23-
{{ if ne $previousLevel 0 }}
24-
{{ if or (eq $previousLevel 2) (eq $previousLevel 3) }}
25-
{{ $tocItem := merge $previousH2 (dict "sub" $h3s) }}
26-
{{ $h2s = $h2s | append $tocItem }}
27-
{{ $h3s = slice }}
28-
{{ end }}
29-
30-
{{ $tocItem := merge $previousH1 (dict "sub" $h2s) }}
31-
{{ $toc = $toc | append $tocItem }}
32-
{{ $h2s = slice }}
33-
{{ $previousH2 = slice }}
34-
{{ end }}
35-
{{ $previousH1 = $item }}
36-
{{ else }}
37-
{{ if eq $level 2 }}
38-
{{ if and (ne $previousLevel 1) (ne $previousLevel 2) }}
39-
{{ $tocItem := merge $previousH2 (dict "sub" $h3s) }}
40-
{{ $h2s = $h2s | append $tocItem }}
41-
{{ $h3s = slice }}
42-
{{ end }}
43-
{{ if eq $previousLevel 2 }}
44-
{{ $h2s = $h2s | append $previousH2 }}
45-
{{ end }}
46-
{{ $previousH2 = $item }}
47-
{{ else }}
48-
{{ $h3s = $h3s | append $item }}
49-
{{ end }}
17+
{{ $level := int (substr . 2 1) }}
18+
{{ if le $level 3 }}
19+
{{ $idTitle := split (. | replaceRE "<h\\d id=\"(.*?)\">(.*)</h\\d>" "$1|$2") "|" }}
20+
{{ $item := dict "level" $level "id" (index $idTitle 0) "title" (index $idTitle 1) }}
21+
22+
{{ if eq $level 1 }}
23+
{{ if ne $previousLevel 0 }}
24+
{{ if or (eq $previousLevel 2) (eq $previousLevel 3) }}
25+
{{ $tocItem := merge $previousH2 (dict "sub" $h3s) }}
26+
{{ $h2s = $h2s | append $tocItem }}
27+
{{ $h3s = slice }}
5028
{{ end }}
51-
{{ $previousLevel = $level }}
29+
30+
{{ $tocItem := merge $previousH1 (dict "sub" $h2s) }}
31+
{{ $toc = $toc | append $tocItem }}
32+
{{ $h2s = slice }}
33+
{{ $previousH2 = slice }}
34+
{{ end }}
35+
{{ $previousH1 = $item }}
36+
{{ else }}
37+
{{ if eq $level 2 }}
38+
{{ if and (ne $previousLevel 1) (ne $previousLevel 2) }}
39+
{{ $tocItem := merge $previousH2 (dict "sub" $h3s) }}
40+
{{ $h2s = $h2s | append $tocItem }}
41+
{{ $h3s = slice }}
42+
{{ end }}
43+
{{ if eq $previousLevel 2 }}
44+
{{ $h2s = $h2s | append $previousH2 }}
45+
{{ end }}
46+
{{ $previousH2 = $item }}
47+
{{ else }}
48+
{{ $h3s = $h3s | append $item }}
49+
{{ end }}
5250
{{ end }}
51+
{{ $previousLevel = $level }}
52+
{{ end }}
5353
{{ end }}
5454

5555
{{ if ne $previousLevel 0 }}
56-
{{ $tocItem := merge $previousH2 (dict "sub" $h3s) }}
57-
{{ $h2s = $h2s | append $tocItem }}
56+
{{ $tocItem := merge $previousH2 (dict "sub" $h3s) }}
57+
{{ $h2s = $h2s | append $tocItem }}
5858

59-
{{ $item := merge $previousH1 (dict "sub" $h2s) }}
60-
{{ $toc = $toc | append $item }}
59+
{{ $item := merge $previousH1 (dict "sub" $h2s) }}
60+
{{ $toc = $toc | append $item }}
6161
{{ end }}
6262

6363
{{ return $toc }}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<img src='{{ relURL "images/logo.png" }}' class="logo" />
1+
<img src="{{ relURL "images/logo.png" }}" class="logo" />

‎layouts/partials/js.html‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@
66
{{ if hugo.IsProduction }}
77
{{ $js = $js | fingerprint }}
88
{{ end }}
9-
<script src="{{ $js.RelPermalink }}" {{ if hugo.IsProduction }}integrity="{{ $js.Data.Integrity }}"{{ end }} defer></script>
9+
<script
10+
src="{{ $js.RelPermalink }}"
11+
{{ if hugo.IsProduction }}integrity="{{ $js.Data.Integrity }}"{{ end }}
12+
defer></script>

‎layouts/partials/styles.html‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22
{{ $cssOpts := (dict "targetPath" "styles/screen.css" "enableSourceMap" $isDev ) }}
33
{{ $screenCSS := resources.Get "scss/slate/screen.css.scss" | toCSS $cssOpts }}
44
{{ $cssOpts = (dict "targetPath" "styles/print.css" "enableSourceMap" $isDev ) }}
5-
{{ $printCSS := resources.Get "scss/slate/print.css.scss" | toCSS $cssOpts }}
5+
{{ $printCSS := resources.Get "scss/slate/print.css.scss" | toCSS $cssOpts }}
66
{{ if not $isDev }}
7-
{{ $printCSS = $printCSS | postCSS | minify | fingerprint }}
8-
{{ $screenCSS = $screenCSS | postCSS | minify | fingerprint }}
7+
{{ $printCSS = $printCSS | postCSS | minify | fingerprint }}
8+
{{ $screenCSS = $screenCSS | postCSS | minify | fingerprint }}
99
{{ end }}
10-
<link href='{{ $screenCSS.RelPermalink }}' rel="stylesheet" media="screen" {{ if not $isDev }}integrity="{{ $screenCSS.Data.Integrity }}"{{ end }} />
11-
<link href='{{ $printCSS.RelPermalink }}' rel="stylesheet" media="print" {{ if not $isDev }}integrity="{{ $printCSS.Data.Integrity }}"{{ end }} />
12-
10+
<link
11+
href="{{ $screenCSS.RelPermalink }}"
12+
rel="stylesheet"
13+
media="screen"
14+
{{ if not $isDev }}integrity="{{ $screenCSS.Data.Integrity }}"{{ end }} />
15+
<link
16+
href="{{ $printCSS.RelPermalink }}"
17+
rel="stylesheet"
18+
media="print"
19+
{{ if not $isDev }}integrity="{{ $printCSS.Data.Integrity }}"{{ end }} />

‎layouts/partials/translations.html‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{{ if .IsTranslated }}
2-
<ul>
2+
<ul>
33
{{ range $i, $e := .Translations }}
4-
<li class="toc-h2"><a href="{{ .Permalink }}">{{ $e.Language.LanguageName }}</a></li>
5-
{{ end}}
6-
</ul>
4+
<li class="toc-h2">
5+
<a href="{{ .Permalink }}">{{ $e.Language.LanguageName }}</a>
6+
</li>
7+
{{ end }}
8+
</ul>
79
{{ end }}

0 commit comments

Comments
 (0)