summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--templates/cmd-index.html.template30
-rw-r--r--templates/games/index.html.template14
-rw-r--r--templates/games/rms.html.template18
-rw-r--r--templates/index.html.template22
-rw-r--r--templates/login.html.template42
-rw-r--r--templates/note.html.template60
-rw-r--r--templates/outline.html.template4
-rw-r--r--templates/pkg-index.html.template24
-rw-r--r--templates/wormhole-success.html.template14
-rw-r--r--templates/wormhole.html.template42
10 files changed, 145 insertions, 125 deletions
diff --git a/templates/cmd-index.html.template b/templates/cmd-index.html.template
index fb8c626..16b89b0 100644
--- a/templates/cmd-index.html.template
+++ b/templates/cmd-index.html.template
@@ -1,15 +1,17 @@
-{{define "head"}}
- <title>Commands</title>
-{{end}}
+{{define "head" -}}
+ <title>Commands</title>
+{{- end}}
-<section>
- <p>Command index</p>
- <ul>
- {{range .Commands}}
- <li>
- <p><a href="https://pkg.go.dev/roseh.moe/cmd/{{.Name}}">{{.Name}}</a> - {{.Description}}</p>
- <p><code>go install roseh.moe/cmd/{{.Name}}{{if .Multi}}/...{{end}}@latest</code></p>
- </li>
- {{end}}
- </ul>
-</section>
+{{define "body" -}}
+ <section>
+ <p>Command index</p>
+ <ul>
+ {{- range .Commands}}
+ <li>
+ <p><a href="https://pkg.go.dev/roseh.moe/cmd/{{.Name}}">{{.Name}}</a> - {{.Description}}</p>
+ <p><code>go install roseh.moe/cmd/{{.Name}}{{if .Multi}}/...{{end}}@latest</code></p>
+ </li>
+ {{- end}}
+ </ul>
+ </section>
+{{- end}}
diff --git a/templates/games/index.html.template b/templates/games/index.html.template
index 917a0c9..f235bd1 100644
--- a/templates/games/index.html.template
+++ b/templates/games/index.html.template
@@ -1,8 +1,10 @@
{{define "head"}}<title>Games</title>{{end}}
-<section>
- <ul>
- <li><a href="/games/pong">Pong</a> (warning: loud)</li>
- <li><a href="/games/rms">RMS shooter</a></li>
- </ul>
-</section>
+{{define "body" -}}
+ <section>
+ <ul>
+ <li><a href="/games/pong">Pong</a> (warning: loud)</li>
+ <li><a href="/games/rms">RMS shooter</a></li>
+ </ul>
+ </section>
+{{- end}}
diff --git a/templates/games/rms.html.template b/templates/games/rms.html.template
index ba00824..9f396fe 100644
--- a/templates/games/rms.html.template
+++ b/templates/games/rms.html.template
@@ -1,10 +1,12 @@
-{{define "head"}}
- <title>RMS shooter</title>
- <script src="/static/games/rms/rms.js" defer></script>
-{{end}}
+{{define "head" -}}
+ <title>RMS shooter</title>
+ <script src="/static/games/rms/rms.js" defer></script>
+{{- end}}
-<img id="sprite-sheet" src="/static/games/rms/sprite-sheet.webp" hidden>
+{{define "body" -}}
+ <img id="sprite-sheet" src="/static/games/rms/sprite-sheet.webp" hidden>
-<section>
- <canvas id="canvas" width="800" height="600"></canvas>
-</section>
+ <section>
+ <canvas id="canvas" width="800" height="600"></canvas>
+ </section>
+{{- end}}
diff --git a/templates/index.html.template b/templates/index.html.template
index 1723ffb..fcb74b6 100644
--- a/templates/index.html.template
+++ b/templates/index.html.template
@@ -1,14 +1,16 @@
{{define "head"}}<title>roseh.moe</title>{{end}}
-<div style="background-image:url(/static/index/stars.webp);background-repeat:repeat;height:500px;display:flex">
- <h1 style="margin:auto">roseh.moe</h1>
-</div>
+{{define "body" -}}
+ <div style="background-image:url(/static/index/stars.webp);background-repeat:repeat;height:500px;display:flex">
+ <h1 style="margin:auto">roseh.moe</h1>
+ </div>
-<section>
- <div style="display:flex">
- <img src="/static/index/kanna.webp" alt="A dragon loli" style="border-radius:50%;margin:-145px auto 20px">
- </div>
+ <section>
+ <div style="display:flex">
+ <img src="/static/index/kanna.webp" alt="A dragon loli" style="border-radius:50%;margin:-145px auto 20px">
+ </div>
- <p><a href="/games/">Games?</a></p>
- <p><a href="/wormhole">Magic wormhole</a></p>
-</section>
+ <p><a href="/games/">Games?</a></p>
+ <p><a href="/wormhole">Magic wormhole</a></p>
+ </section>
+{{- end}}
diff --git a/templates/login.html.template b/templates/login.html.template
index 1aef0f2..ce46bd1 100644
--- a/templates/login.html.template
+++ b/templates/login.html.template
@@ -1,22 +1,24 @@
{{define "head"}}<title>Login</title>{{end}}
-<section>
- {{if .Error}}
- <p class="login-error"><img class="inline" src="/static/angry.webp">Incorrect password</p>
- {{end}}
- <form class="password-form" method="post">
- <table>
- <tr class="password-form-row">
- <td><label class="password-label" for="password">Enter password</label></td>
- <td><input id="password" class="password" type="password" name="password" autofocus></td>
- </tr>
- <tr class="password-form-row">
- <td><label class="password-label" for="auth">Google authenticator code</label></td>
- <td><input id="auth" class="password" name="auth"></td>
- </tr>
- <tr>
- <td></td>
- <td><input type="image" width="100" class="submit" src="/static/point.webp" alt="Submit"></td>
- </table>
- </form>
-</section>
+{{define "body" -}}
+ <section>
+ {{- if .Error}}
+ <p class="login-error"><img class="inline" src="/static/angry.webp">Incorrect password</p>
+ {{- end}}
+ <form class="password-form" method="post">
+ <table>
+ <tr class="password-form-row">
+ <td><label class="password-label" for="password">Enter password</label></td>
+ <td><input id="password" class="password" type="password" name="password" autofocus></td>
+ </tr>
+ <tr class="password-form-row">
+ <td><label class="password-label" for="auth">Google authenticator code</label></td>
+ <td><input id="auth" class="password" name="auth"></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td><input type="image" width="100" class="submit" src="/static/point.webp" alt="Submit"></td>
+ </table>
+ </form>
+ </section>
+{{- end}}
diff --git a/templates/note.html.template b/templates/note.html.template
index 19da416..3c7049c 100644
--- a/templates/note.html.template
+++ b/templates/note.html.template
@@ -1,31 +1,33 @@
-{{define "head"}}
- <script src="/static/htmx.min.js"></script>
- <title>Notepad</title>
+{{define "head" -}}
+ <script src="/static/htmx.min.js"></script>
+ <title>Notepad</title>
- <meta name="viewport" content="interactive-widget=resizes-content"> <!-- https://stackoverflow.com/q/76026292 -->
-{{end}}
+ <meta name="viewport" content="interactive-widget=resizes-content"> <!-- https://stackoverflow.com/q/76026292 -->
+{{- end}}
-<form id="form" method="post">
- <div class="save-indicator-container">
- {{block "saveIndicator" ""}}
- <span id="save-indicator">{{.}}</span>
- {{end}}
- </div>
- <div class="content-container">
- <textarea
- name="content"
- hx-post="/notepad"
- hx-on:input="
- const indicator = htmx.find('#save-indicator');
- htmx.addClass(indicator, 'htmx-indicator');
- indicator.innerHTML = 'Saving...';
- "
- hx-trigger="input delay:1s"
- hx-indicator="#save-indicator"
- hx-target="#save-indicator"
- hx-swap="outerHTML"
- autofocus>
- {{- .Content -}}
- </textarea>
- </div>
-</form>
+{{define "body" -}}
+ <form id="form" method="post">
+ <div class="save-indicator-container">
+ {{- block "saveIndicator" ""}}
+ <span id="save-indicator">{{.}}</span>
+ {{- end}}
+ </div>
+ <div class="content-container">
+ <textarea
+ name="content"
+ hx-post="/notepad"
+ hx-on:input="
+ const indicator = htmx.find('#save-indicator');
+ htmx.addClass(indicator, 'htmx-indicator');
+ indicator.innerHTML = 'Saving...';
+ "
+ hx-trigger="input delay:1s"
+ hx-indicator="#save-indicator"
+ hx-target="#save-indicator"
+ hx-swap="outerHTML"
+ autofocus>
+ {{- .Content -}}
+ </textarea>
+ </div>
+ </form>
+{{- end}}
diff --git a/templates/outline.html.template b/templates/outline.html.template
index fd3c215..6ef1fe0 100644
--- a/templates/outline.html.template
+++ b/templates/outline.html.template
@@ -6,5 +6,7 @@
{{template "head" .}}
</head>
- <body>{{template "body" .}}</body>
+ <body>
+ {{template "body" .}}
+ </body>
</html>
diff --git a/templates/pkg-index.html.template b/templates/pkg-index.html.template
index d8cd12e..fc88ed4 100644
--- a/templates/pkg-index.html.template
+++ b/templates/pkg-index.html.template
@@ -1,12 +1,14 @@
-{{define "head"}}
- <title>Packages</title>
-{{end}}
+{{define "head" -}}
+ <title>Packages</title>
+{{- end}}
-<section>
- <p>Package index</p>
- <ul>
- {{range .Packages}}
- <li><p><a href="https://pkg.go.dev/roseh.moe/pkg/{{.Name}}">roseh.moe/pkg/{{.Name}}</a> - {{.Description}}</p></li>
- {{end}}
- </ul>
-</section>
+{{define "body" -}}
+ <section>
+ <p>Package index</p>
+ <ul>
+ {{- range .Packages}}
+ <li><p><a href="https://pkg.go.dev/roseh.moe/pkg/{{.Name}}">roseh.moe/pkg/{{.Name}}</a> - {{.Description}}</p></li>
+ {{- end}}
+ </ul>
+ </section>
+{{- end}}
diff --git a/templates/wormhole-success.html.template b/templates/wormhole-success.html.template
index a957173..dbb997e 100644
--- a/templates/wormhole-success.html.template
+++ b/templates/wormhole-success.html.template
@@ -1,8 +1,10 @@
{{define "head"}}<title>Uploaded!</title>{{end}}
-<div style="display:flex;flex-direction:column;align-items:center;font-size:50px">
- <p><a href="{{.URL}}">{{.URL}}</a></p>
- <img src="{{.QR}}" alt="QR code for {{.URL}}" width="500px">
- <p>Uploaded!</p>
- <img src="/static/tohru.webp" alt="An energetic dragon maid">
-</div>
+{{define "body" -}}
+ <div style="display:flex;flex-direction:column;align-items:center;font-size:50px">
+ <p><a href="{{.URL}}">{{.URL}}</a></p>
+ <img src="{{.QR}}" alt="QR code for {{.URL}}" width="500px">
+ <p>Uploaded!</p>
+ <img src="/static/tohru.webp" alt="An energetic dragon maid">
+ </div>
+{{- end}}
diff --git a/templates/wormhole.html.template b/templates/wormhole.html.template
index 6f7ad1b..9c770c1 100644
--- a/templates/wormhole.html.template
+++ b/templates/wormhole.html.template
@@ -1,21 +1,23 @@
-{{define "head"}}
- <title>Wormhole</title>
-{{end}}
+{{define "head" -}}
+ <title>Wormhole</title>
+{{- end}}
-<form
- method="post"
- enctype="multipart/form-data"
- class="wormhole">
- <ol>
- <li>
- <input type="file" name="file" multiple>
- </li>
- <li>
- <input type="submit" value="Upload" class="wormhole-input">
- {{if .Err}}
- <p><img class="inline" src="/static/confused.webp" alt="A logical dragon maid"><span style="color:red">{{.Err}}</span></p>
- {{end}}
- </li>
- </ol>
- Files will be deleted after 1 hour
-</form>
+{{define "body" -}}
+ <form
+ method="post"
+ enctype="multipart/form-data"
+ class="wormhole">
+ <ol>
+ <li>
+ <input type="file" name="file" multiple>
+ </li>
+ <li>
+ <input type="submit" value="Upload" class="wormhole-input">
+ {{- if .Err}}
+ <p><img class="inline" src="/static/confused.webp" alt="A logical dragon maid"><span style="color:red">{{.Err}}</span></p>
+ {{- end}}
+ </li>
+ </ol>
+ Files will be deleted after 1 hour
+ </form>
+{{- end}}