aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hergès <william@herges.fr>2026-01-16 22:05:19 +0100
committerWilliam Hergès <william@herges.fr>2026-01-16 22:05:19 +0100
commit6ab3a7bd5640623aeb7847f1eb2f1077d8e777f3 (patch)
tree87ace5305cbf4aefc67fdbe407ae94e673845c45
parentf67c350197e1c46887baf67398445e2b47a8f067 (diff)
style(html): use prettier plugin for go html
-rw-r--r--.prettierrc11
-rw-r--r--backend/templates/404.html18
-rw-r--r--backend/templates/admin.html102
-rw-r--r--backend/templates/base.html4
-rw-r--r--backend/templates/components.html62
-rw-r--r--backend/templates/data.html22
-rw-r--r--backend/templates/home.html34
-rw-r--r--backend/templates/home_section.html21
-rw-r--r--backend/templates/simple.html2
-rw-r--r--bun.lock5
-rw-r--r--package.json3
11 files changed, 156 insertions, 128 deletions
diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 0000000..a141374
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,11 @@
+{
+ "plugins": ["prettier-plugin-go-template"],
+ "overrides": [
+ {
+ "files": ["*.html"],
+ "options": {
+ "parser": "go-template"
+ }
+ }
+ ]
+}
diff --git a/backend/templates/404.html b/backend/templates/404.html
index e0bca68..52d3cc9 100644
--- a/backend/templates/404.html
+++ b/backend/templates/404.html
@@ -1,11 +1,11 @@
{{ define "body" }}
-<main id="content">
- <h1>Oh non, je crois que tu t'es perdu :(</h1>
- <p>Tu as des liens en haut pour retrouver ton chemin :3</p>
- <p>
- Si tu penses que c'est un bug, hésite pas à ouvrir une issue sur
- <a href="https://github.com/anhgelus/small-web/issues">GitHub</a> :D
- </p>
- <p>(enfin, sauf si tu as un compte sur ma forge, mais ça m'étonnerait...)</p>
-</main>
+ <main id="content">
+ <h1>Oh non, je crois que tu t'es perdu :(</h1>
+ <p>Tu as des liens en haut pour retrouver ton chemin :3</p>
+ <p>
+ Si tu penses que c'est un bug, hésite pas à ouvrir une issue sur
+ <a href="https://github.com/anhgelus/small-web/issues">GitHub</a> :D
+ </p>
+ <p>(enfin, sauf si tu as un compte sur ma forge, mais ça m'étonnerait...)</p>
+ </main>
{{ end }}
diff --git a/backend/templates/admin.html b/backend/templates/admin.html
index 008827f..c4c83c5 100644
--- a/backend/templates/admin.html
+++ b/backend/templates/admin.html
@@ -1,51 +1,51 @@
-{{define "body"}}
-<main id="content">
- <div class="introduction">
- <h1>Administration</h1>
- <p>
- Panel d'administration très simple. Il affiche les stats et possiblement les webmentions et autre contenu à
- modérer.
- </p>
- </div>
- <article>
- <h2>Stats</h2>
- <h3>Visits</h3>
- <table>
- <thead>
- <tr>
- <th>Target</th>
- <th>Visits</th>
- </tr>
- </thead>
- <tbody>
- {{ range .Visits }}
- <tr>
- <td>{{ .Target }}</td>
- <td>{{ .Visit }}</td>
- </tr>
- {{ end }}
- </tbody>
- </table>
- <h3>Origin</h3>
- <table>
- <thead>
- <tr>
- <th>Origin</th>
- <th>Target</th>
- <th>Visits</th>
- </tr>
- </thead>
- <tbody>
- {{ range .Rows }}
- <tr>
- <td>{{ .Origin }}</td>
- <td>{{ .Target }}</td>
- <td>{{ .Visit }}</td>
- </tr>
- {{ end }}
- </tbody>
- </table>
- <div class="pagination">{{ template "pagination" . }}</div>
- </article>
-</main>
-{{end}}
+{{ define "body" }}
+ <main id="content">
+ <div class="introduction">
+ <h1>Administration</h1>
+ <p>
+ Panel d'administration très simple. Il affiche les stats et possiblement les webmentions et autre contenu à
+ modérer.
+ </p>
+ </div>
+ <article>
+ <h2>Stats</h2>
+ <h3>Visits</h3>
+ <table>
+ <thead>
+ <tr>
+ <th>Target</th>
+ <th>Visits</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{ range .Visits }}
+ <tr>
+ <td>{{ .Target }}</td>
+ <td>{{ .Visit }}</td>
+ </tr>
+ {{ end }}
+ </tbody>
+ </table>
+ <h3>Origin</h3>
+ <table>
+ <thead>
+ <tr>
+ <th>Origin</th>
+ <th>Target</th>
+ <th>Visits</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{ range .Rows }}
+ <tr>
+ <td>{{ .Origin }}</td>
+ <td>{{ .Target }}</td>
+ <td>{{ .Visit }}</td>
+ </tr>
+ {{ end }}
+ </tbody>
+ </table>
+ <div class="pagination">{{ template "pagination" . }}</div>
+ </article>
+ </main>
+{{ end }}
diff --git a/backend/templates/base.html b/backend/templates/base.html
index 20abcd0..b2071b1 100644
--- a/backend/templates/base.html
+++ b/backend/templates/base.html
@@ -18,7 +18,7 @@
<meta property="og:local" content="fr_FR" />
<meta property="og:site_name" content="{{ .Name }}" />
{{ if ne .PubDate "" }}
- <meta property="article:published_time" content="{{ .PubDate }}" />
+ <meta property="article:published_time" content="{{ .PubDate }}" />
{{ end }}
<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image" />
@@ -32,7 +32,7 @@
<header>
<img src="{{ static .Logo.Header }}" alt="Logo" />
{{ $url := .URL }}
- <nav>{{ range .Links }}{{ .Render $url }}{{end}}</nav>
+ <nav>{{ range .Links }}{{ .Render $url }}{{ end }}</nav>
</header>
{{ template "body" . }}
<footer>
diff --git a/backend/templates/components.html b/backend/templates/components.html
index b180123..e49a8c4 100644
--- a/backend/templates/components.html
+++ b/backend/templates/components.html
@@ -1,29 +1,39 @@
{{ define "pagination" }}
-<nav>
- {{ if ne .CurrentPage 1 }}<a href="?page={{ before .CurrentPage }}">Précédent</a>{{else}}
- <p></p>
- {{end}}
- <p>{{ .CurrentPage }}/{{ .PagesNumber }}</p>
- {{ if ne .CurrentPage .PagesNumber }}<a href="?page={{ next .CurrentPage }}">Suivant</a>{{else}}
- <p></p>
- {{end}}
-</nav>
-{{ end }} {{define "section_display"}}
-<article>
- {{ $uri := .URI }} {{ range .Data }}
+ <nav>
+ {{ if ne .CurrentPage 1 }}
+ <a href="?page={{ before .CurrentPage }}">Précédent</a>
+ {{ else }}
+ <p></p>
+ {{ end }}
+ <p>{{ .CurrentPage }}/{{ .PagesNumber }}</p>
+ {{ if ne .CurrentPage .PagesNumber }}
+ <a href="?page={{ next .CurrentPage }}">Suivant</a>
+ {{ else }}
+ <p></p>
+ {{ end }}
+ </nav>
+{{ end }}
+{{ define "section_display" }}
<article>
- <h3><a href="/{{ $uri }}/{{ .Slug }}">{{ .DataTitle }}</a></h3>
- <figure>
- <a href="/{{ $uri }}/{{ .Slug }}"><img src="{{ static .Img.Src }}" alt="{{ .Img.Alt }}" /></a>
- <figcaption>{{ .Img.Legend }}</figcaption>
- </figure>
- <p>{{ .Description }}</p>
+ {{ $uri := .URI }}
+ {{ range .Data }}
+ <article>
+ <h3><a href="/{{ $uri }}/{{ .Slug }}">{{ .DataTitle }}</a></h3>
+ <figure>
+ <a href="/{{ $uri }}/{{ .Slug }}"><img src="{{ static .Img.Src }}" alt="{{ .Img.Alt }}" /></a>
+ <figcaption>{{ .Img.Legend }}</figcaption>
+ </figure>
+ <p>{{ .Description }}</p>
+ </article>
+ {{ end }}
+ <div class="pagination">
+ {{ if .Paginate }}
+ {{ template "pagination" . }}
+ {{ else }}
+ {{ if eq (len .Data) .LenMax }}
+ <a href="/{{ $uri }}/">Voir plus</a>
+ {{ end }}
+ {{ end }}
+ </div>
</article>
- {{ end }}
- <div class="pagination">
- {{ if .Paginate }} {{ template "pagination" . }} {{ else }} {{ if eq (len .Data) .LenMax }}
- <a href="/{{ $uri }}/">Voir plus</a>
- {{ end }} {{ end }}
- </div>
-</article>
-{{end}}
+{{ end }}
diff --git a/backend/templates/data.html b/backend/templates/data.html
index a384459..e548bef 100644
--- a/backend/templates/data.html
+++ b/backend/templates/data.html
@@ -1,11 +1,11 @@
-{{define "body"}}
-<article id="content">
- <h1>{{ .DataTitle }}</h1>
- <p>{{ .Description }}</p>
- <figure>
- <img src="{{ static .Img.Src }}" alt="{{ .Img.Alt }}" class="large" />
- <figcaption>{{ .Img.Legend }}</figcaption>
- </figure>
- {{ .Content }}
-</article>
-{{end}}
+{{ define "body" }}
+ <article id="content">
+ <h1>{{ .DataTitle }}</h1>
+ <p>{{ .Description }}</p>
+ <figure>
+ <img src="{{ static .Img.Src }}" alt="{{ .Img.Alt }}" class="large" />
+ <figcaption>{{ .Img.Legend }}</figcaption>
+ </figure>
+ {{ .Content }}
+ </article>
+{{ end }}
diff --git a/backend/templates/home.html b/backend/templates/home.html
index d574525..4d4271f 100644
--- a/backend/templates/home.html
+++ b/backend/templates/home.html
@@ -1,17 +1,17 @@
-{{define "body"}}
-<main id="content">
- <div class="introduction">
- <h1>{{ .Name }}</h1>
- <p>{{ .PageDescription }}</p>
- </div>
- <div class="sections">
- {{ range .Sections }}
- <section>
- <h2>{{ .Name }}</h2>
- <p>{{ .Description }}</p>
- {{ template "section_display" . }}
- </section>
- {{ end }}
- </div>
-</main>
-{{end}}
+{{ define "body" }}
+ <main id="content">
+ <div class="introduction">
+ <h1>{{ .Name }}</h1>
+ <p>{{ .PageDescription }}</p>
+ </div>
+ <div class="sections">
+ {{ range .Sections }}
+ <section>
+ <h2>{{ .Name }}</h2>
+ <p>{{ .Description }}</p>
+ {{ template "section_display" . }}
+ </section>
+ {{ end }}
+ </div>
+ </main>
+{{ end }}
diff --git a/backend/templates/home_section.html b/backend/templates/home_section.html
index cf7595d..1101843 100644
--- a/backend/templates/home_section.html
+++ b/backend/templates/home_section.html
@@ -1,10 +1,11 @@
-{{define "body"}}
-<main id="content">
- {{ range .Sections }}
- <div class="introduction">
- <h1>{{ .Name }}</h1>
- <p>{{ .Description }}</p>
- </div>
- {{ template "section_display" . }} {{ end }}
-</main>
-{{end}}
+{{ define "body" }}
+ <main id="content">
+ {{ range .Sections }}
+ <div class="introduction">
+ <h1>{{ .Name }}</h1>
+ <p>{{ .Description }}</p>
+ </div>
+ {{ template "section_display" . }}
+ {{ end }}
+ </main>
+{{ end }}
diff --git a/backend/templates/simple.html b/backend/templates/simple.html
index 94721df..44d79a9 100644
--- a/backend/templates/simple.html
+++ b/backend/templates/simple.html
@@ -1,3 +1,3 @@
{{ define "body" }}
-<main id="content">{{ .Content }}</main>
+ <main id="content">{{ .Content }}</main>
{{ end }}
diff --git a/bun.lock b/bun.lock
index e8fcdfd..db6a798 100644
--- a/bun.lock
+++ b/bun.lock
@@ -11,6 +11,7 @@
"devDependencies": {
"@types/bun": "latest",
"prettier": "^3.7.4",
+ "prettier-plugin-go-template": "^0.0.15",
},
"peerDependencies": {
"typescript": "^5.9.3",
@@ -78,6 +79,8 @@
"prettier": ["prettier@3.7.4", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-v6UNi1+3hSlVvv8fSaoUbggEM5VErKmmpGA7Pl3HF8V6uKY7rvClBOJlH6yNwQtfTueNkGVpOv/mtWL9L4bgRA=="],
+ "prettier-plugin-go-template": ["prettier-plugin-go-template@0.0.15", "", { "dependencies": { "ulid": "^2.3.0" }, "peerDependencies": { "prettier": "^3.0.0" } }, "sha512-WqU92E1NokWYNZ9mLE6ijoRg6LtIGdLMePt2C7UBDjXeDH9okcRI3zRqtnWR4s5AloiqyvZ66jNBAa9tmRY5EQ=="],
+
"readdirp": ["readdirp@4.1.2", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="],
"reset-css": ["reset-css@5.0.2", "", {}, "sha512-YtgUGSq5z5W0NPSjsBW7ys7rtWa8P8AiE7S6Fg3d1TQCPpAodgYyLuZYlU0AOsLtprk/fC9ormHN/0pAavVIDw=="],
@@ -92,6 +95,8 @@
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
+ "ulid": ["ulid@2.4.0", "", { "bin": { "ulid": "bin/cli.js" } }, "sha512-fIRiVTJNcSRmXKPZtGzFQv9WRrZ3M9eoptl/teFJvjOzmpU+/K/JH6HZ8deBfb5vMEpicJcLn7JmvdknlMq7Zg=="],
+
"undici-types": ["undici-types@7.13.0", "", {}, "sha512-Ov2Rr9Sx+fRgagJ5AX0qvItZG/JKKoBRAVITs1zk7IqZGTJUwgUr7qoYBpWwakpWilTZFM98rG/AFRocu10iIQ=="],
}
}
diff --git a/package.json b/package.json
index d3b2fd7..2ffbe98 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,8 @@
},
"devDependencies": {
"@types/bun": "latest",
- "prettier": "^3.7.4"
+ "prettier": "^3.7.4",
+ "prettier-plugin-go-template": "^0.0.15"
},
"peerDependencies": {
"typescript": "^5.9.3"