aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2024-06-02 20:19:37 -0400
committerXe Iaso <me@xeiaso.net>2024-06-02 20:19:37 -0400
commite92fea88dd9c0f95846ec947e10336489ee8e42c (patch)
tree4b2b99063e98287272d368b799e8601e2a097d60 /cmd
parent66f4ff94a91df8b2e87e7320710bf7e1b819f710 (diff)
downloadx-e92fea88dd9c0f95846ec947e10336489ee8e42c.tar.xz
x-e92fea88dd9c0f95846ec947e10336489ee8e42c.zip
tree-wide: use templ
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/azurda/index.templ47
-rw-r--r--cmd/azurda/index_templ.go83
-rw-r--r--cmd/azurda/main.go18
-rw-r--r--cmd/azurda/static/css/podkova.woff2bin60580 -> 0 bytes
-rw-r--r--cmd/azurda/static/css/xess.css83
-rw-r--r--cmd/azurda/static/index.html55
-rw-r--r--cmd/hlang/hlang.templ169
-rw-r--r--cmd/hlang/hlang_templ.go168
-rw-r--r--cmd/hlang/http.go372
-rw-r--r--cmd/sanguisuga/admin.go47
-rw-r--r--cmd/sanguisuga/main.go14
-rw-r--r--cmd/sanguisuga/sanguisuga.templ346
-rw-r--r--cmd/sanguisuga/sanguisuga_templ.go191
-rw-r--r--cmd/sanguisuga/tailwind.config.js2
-rw-r--r--cmd/sanguisuga/tmpl/404.html7
-rw-r--r--cmd/sanguisuga/tmpl/anime_index.html114
-rw-r--r--cmd/sanguisuga/tmpl/base.html39
-rw-r--r--cmd/sanguisuga/tmpl/index.html18
-rw-r--r--cmd/sanguisuga/tmpl/tv_index.html116
-rw-r--r--cmd/todayinmarch2020/html.templ38
-rw-r--r--cmd/todayinmarch2020/html_templ.go126
-rw-r--r--cmd/todayinmarch2020/main.go38
-rw-r--r--cmd/todayinmarch2020/quips.json6
-rw-r--r--cmd/todayinmarch2020/templates/index.html37
-rw-r--r--cmd/tourian/main.go88
-rw-r--r--cmd/tourian/static/index.html108
-rw-r--r--cmd/tourian/static/message.html219
-rw-r--r--cmd/tourian/tailwind.config.js2
-rw-r--r--cmd/tourian/tmpl/bubble.html24
-rw-r--r--cmd/tourian/tmpl/convid.html3
-rw-r--r--cmd/tourian/tmpl/form-reset.html5
-rw-r--r--cmd/tourian/tmpl/message.html30
-rw-r--r--cmd/tourian/tmpl/remove-welcome.html1
-rw-r--r--cmd/tourian/tourian.templ303
-rw-r--r--cmd/tourian/tourian_templ.go380
-rw-r--r--cmd/within.website/html.templ34
-rw-r--r--cmd/within.website/html_templ.go232
-rw-r--r--cmd/within.website/main.go79
-rw-r--r--cmd/within.website/tmpl/404.tmpl5
-rw-r--r--cmd/within.website/tmpl/base.tmpl21
-rw-r--r--cmd/within.website/tmpl/botinfo.tmpl7
-rw-r--r--cmd/within.website/tmpl/index.tmpl23
42 files changed, 2281 insertions, 1417 deletions
diff --git a/cmd/azurda/index.templ b/cmd/azurda/index.templ
new file mode 100644
index 0000000..21f431a
--- /dev/null
+++ b/cmd/azurda/index.templ
@@ -0,0 +1,47 @@
+package main
+
+templ headerJS() {
+ <script src="/static/js/alpine.js" defer></script>
+ <script src="/static/js/md5.min.js" defer></script>
+ <script>
+ document.addEventListener("alpine:init", () => {
+ Alpine.data("azurda", () => ({
+ str: "", // The input string
+ md5: "", // md5 hash of the string
+ url: "/static/img/azurda.png", // image for user
+ md5sum() {
+ return new Promise((resolve) => {
+ this.md5 = md5(this.str);
+ this.url = `https://cdn.xeiaso.net/avatar/${this.md5}`;
+ resolve(this.md5);
+ });
+ },
+ }));
+ });
+ </script>
+}
+
+templ body() {
+ <p>Type in some text and get a randomly generated avatar!</p>
+ <div x-data="azurda">
+ <input
+ @input.debounce.500ms="md5sum().then((hash) => console.log(hash))"
+ type="text"
+ x-model="str"
+ />
+ <br/>
+ <img
+ style="margin-top: 2rem"
+ x-bind:src="url"
+ alt="Azurda"
+ width="256px"
+ />
+ </div>
+}
+
+templ footer() {
+ <p>
+ From <a href="https://within.website">Within</a> with ❤️ -
+ <a href="">Source code</a>
+ </p>
+}
diff --git a/cmd/azurda/index_templ.go b/cmd/azurda/index_templ.go
new file mode 100644
index 0000000..6a5b42b
--- /dev/null
+++ b/cmd/azurda/index_templ.go
@@ -0,0 +1,83 @@
+// Code generated by templ - DO NOT EDIT.
+
+// templ: version: v0.2.707
+package main
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import "context"
+import "io"
+import "bytes"
+
+func headerJS() templ.Component {
+ return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script src=\"/static/js/alpine.js\" defer></script><script src=\"/static/js/md5.min.js\" defer></script><script>\n document.addEventListener(\"alpine:init\", () => {\n Alpine.data(\"azurda\", () => ({\n str: \"\", // The input string\n md5: \"\", // md5 hash of the string\n url: \"/static/img/azurda.png\", // image for user\n md5sum() {\n return new Promise((resolve) => {\n this.md5 = md5(this.str);\n this.url = `https://cdn.xeiaso.net/avatar/${this.md5}`;\n resolve(this.md5);\n });\n },\n }));\n });\n </script>")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func body() templ.Component {
+ return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var2 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var2 == nil {
+ templ_7745c5c3_Var2 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<p>Type in some text and get a randomly generated avatar!</p><div x-data=\"azurda\"><input @input.debounce.500ms=\"md5sum().then((hash) =&gt; console.log(hash))\" type=\"text\" x-model=\"str\"><br><img style=\"margin-top: 2rem\" x-bind:src=\"url\" alt=\"Azurda\" width=\"256px\"></div>")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func footer() templ.Component {
+ return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var3 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var3 == nil {
+ templ_7745c5c3_Var3 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<p>From <a href=\"https://within.website\">Within</a> with ❤️ - <a href=\"\">Source code</a></p>")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
diff --git a/cmd/azurda/main.go b/cmd/azurda/main.go
index 2daab97..35bd2a1 100644
--- a/cmd/azurda/main.go
+++ b/cmd/azurda/main.go
@@ -18,14 +18,18 @@ import (
"regexp"
"time"
+ "github.com/a-h/templ"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp"
"golang.org/x/sync/errgroup"
"within.website/x/internal"
"within.website/x/web/stablediffusion"
+ "within.website/x/xess"
)
+//go:generate go run github.com/a-h/templ/cmd/templ@latest generate
+
var (
accessKey = flag.String("access-key", "", "Access key for the client to use")
secretKey = flag.String("secret-key", "", "Secret key for the client to use")
@@ -87,9 +91,15 @@ func main() {
mux := http.NewServeMux()
- mux.HandleFunc("/{$}", func(w http.ResponseWriter, r *http.Request) {
- http.ServeFileFS(w, r, static, "static/index.html")
- })
+ xess.Mount(mux)
+
+ mux.Handle("/{$}", templ.Handler(xess.Base(
+ "Azurda",
+ headerJS(),
+ nil,
+ body(),
+ footer(),
+ )))
mux.Handle("/static/", http.FileServerFS(static))
mux.HandleFunc("GET fallthrough.azurda.within.website/{hash}", ServeStableDiffusion)
@@ -115,7 +125,7 @@ func main() {
func SpewMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- slog.Info("got request", "method", r.Method, "url", r.URL.String(), "headers", r.Header)
+ slog.Debug("got request", "method", r.Method, "url", r.URL.String(), "headers", r.Header)
next.ServeHTTP(w, r)
})
}
diff --git a/cmd/azurda/static/css/podkova.woff2 b/cmd/azurda/static/css/podkova.woff2
deleted file mode 100644
index 508f97d..0000000
--- a/cmd/azurda/static/css/podkova.woff2
+++ /dev/null
Binary files differ
diff --git a/cmd/azurda/static/css/xess.css b/cmd/azurda/static/css/xess.css
deleted file mode 100644
index fe9fee2..0000000
--- a/cmd/azurda/static/css/xess.css
+++ /dev/null
@@ -1,83 +0,0 @@
-@import url(https://cdn.xeiaso.net/static/css/iosevka/family.css);
-@font-face {
- font-family: "Podkova";
- font-style: normal;
- font-weight: 400 800;
- font-display: swap;
- src: url("podkova.woff2") format("woff2");
-}
-main {
- font-family: Iosevka Aile Iaso, sans-serif;
- max-width: 50rem;
- padding: 2rem;
- margin: auto;
-}
-@media only screen and (max-device-width: 736px) {
- main {
- padding: 0;
- }
-}
-::selection {
- background: #d3869b;
-}
-body {
- background: #1d2021;
- color: #f9f5d7;
-}
-pre {
- background-color: #3c3836;
- padding: 1em;
- border: 0;
- font-family: Iosevka Curly Iaso, monospace;
-}
-a,
-a:active,
-a:visited {
- color: #b16286;
- background-color: #282828;
-}
-h1,
-h2,
-h3,
-h4,
-h5 {
- margin-bottom: 0.1rem;
- font-family: Podkova, serif;
-}
-blockquote {
- border-left: 1px solid #bdae93;
- margin: 0.5em 10px;
- padding: 0.5em 10px;
-}
-footer {
- align: center;
-}
-@media (prefers-color-scheme: light) {
- body {
- background: #f9f5d7;
- color: #1d2021;
- }
- pre {
- background-color: #ebdbb2;
- padding: 1em;
- border: 0;
- }
- a,
- a:active,
- a:visited {
- color: #b16286;
- background-color: #fbf1c7;
- }
- h1,
- h2,
- h3,
- h4,
- h5 {
- margin-bottom: 0.1rem;
- }
- blockquote {
- border-left: 1px solid #655c54;
- margin: 0.5em 10px;
- padding: 0.5em 10px;
- }
-}
diff --git a/cmd/azurda/static/index.html b/cmd/azurda/static/index.html
deleted file mode 100644
index 949a854..0000000
--- a/cmd/azurda/static/index.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>Azurda</title>
- <link rel="stylesheet" href="/static/css/xess.css" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <script src="/static/js/alpine.js" defer></script>
- <script src="/static/js/md5.min.js" defer></script>
- <script>
- document.addEventListener("alpine:init", () => {
- Alpine.data("azurda", () => ({
- str: "", // The input string
- md5: "", // md5 hash of the string
- url: "/static/img/azurda.png", // image for user
- md5sum() {
- return new Promise((resolve) => {
- this.md5 = md5(this.str);
- this.url = `https://cdn.xeiaso.net/avatar/${this.md5}`;
- resolve(this.md5);
- });
- },
- }));
- });
- </script>
- </head>
- <body id="top">
- <main>
- <h1>Azurda</h1>
-
- <p>Type in some text and get a randomly generated avatar!</p>
-
- <div x-data="azurda">
- <input
- @input.debounce.500ms="md5sum().then((hash) => console.log(hash))"
- type="text"
- x-model="str"
- />
- <br />
- <img
- style="margin-top: 2rem"
- x-bind:src="url"
- alt="Azurda"
- width="256px"
- />
- </div>
-
- <footer>
- <p>
- From <a href="https://within.website">Within</a> with ❤️ -
- <a href="">Source code</a>
- </p>
- </footer>
- </main>
- </body>
-</html>
diff --git a/cmd/hlang/hlang.templ b/cmd/hlang/hlang.templ
new file mode 100644
index 0000000..b5fe57b
--- /dev/null
+++ b/cmd/hlang/hlang.templ
@@ -0,0 +1,169 @@
+package main
+
+templ navbar() {
+ <a href="/">The h programming language</a> -
+ <a href="/docs">Docs</a> -
+ <a href="/play">Playground</a> -
+ <a href="/faq">FAQ</a>
+}
+
+templ footer() {
+ <p>From <a href="https://xeiaso.net">Within</a></p>
+}
+
+templ homePage() {
+ <p><big>A simple, fast, open-source, complete and safe language for developing modern software for the web</big></p>
+ <hr/>
+ <h2>Example Program</h2>
+ <code><pre>h</pre></code>
+ <p>Outputs:</p>
+ <code><pre>h</pre></code>
+ <hr/>
+ <h2>Fast Compilation</h2>
+ <p>h probably compiles hundreds of characters of source per second. I didn't really test how fast it is, but when I was testing it the speed was fast enough that I didn't care to profile it.</p>
+ <hr/>
+ <h2>Safety</h2>
+ <p>h is completely memory safe with no garbage collector or heap allocations. It does not allow memory leaks to happen, nor do any programs in h have the possibility to allocate memory.</p>
+ <ul>
+ <li>No null</li>
+ <li>Completely deterministic behavior</li>
+ <li>No mutable state</li>
+ <li>No persistence</li>
+ <li>All functions are pure functions</li>
+ <li>No sandboxing required</li>
+ </ul>
+ <hr/>
+ <h2>Zero* Dependencies</h2>
+ <p>h generates <a href="http://webassembly.org">WebAssembly</a>, so every binary produced by the compiler is completely dependency free save a single system call: <code>h.h</code>. This allows for modern, future-proof code that will work on all platforms.</p>
+ <hr/>
+ <h2>Simple</h2>
+ <p>h has a <a href="/grammar/h.peg">simple grammar</a> that gzips to 117 bytes. Creating a runtime environment for h is so trivial just about anyone can do it.</p>
+ <hr/>
+ <h2>Platform Support</h2>
+ <p>h supports the following platforms:</p>
+ <ul>
+ <li>Google Chrome</li>
+ <li>Electron</li>
+ <li>Chromium Embedded Framework</li>
+ <li>Microsoft Edge</li>
+ <li>Pa'i</li>
+ </ul>
+ <hr/>
+ <h2>International Out of the Box</h2>
+ <p>h supports multiple written and spoken languages with true contextual awareness. It not only supports the Latin <code>h</code> as input, it also accepts the <a href="http://lojban.org">Lojbanic</a> <code>'</code> as well. This allows for full 100% internationalization into Lojban should your project needs require it.</p>
+ <hr/>
+ <h2>Testimonials</h2>
+ <p>Not convinced? Take the word of people we probably didn't pay for their opinion.</p>
+ <ul>
+ <li>I don't see the point of this.</li>
+ <li>This solves all my problems. All of them. Just not in the way I expected it to.</li>
+ <li>Yes.</li>
+ <li>Perfect.</li>
+ <li>h is the backbone of my startup.</li>
+ </ul>
+ <hr/>
+ <h2>Open-Source</h2>
+ <p>The h compiler and default runtime are <a href="https://tulpa.dev/cadey/hlang">open-source</a> free software sent out into the <a href="https://creativecommons.org/choose/zero/">Public Domain</a>. You can use h for any purpose at all with no limitations or restrictions.</p>
+ <hr/>
+}
+
+templ docsPage() {
+ <p><big id="comingsoon">Coming soon...</big></p>
+ <script>
+ Date.prototype.addDays = function(days) {
+ var date = new Date(this.valueOf());
+ date.setDate(date.getDate() + days);
+ return date;
+ }
+
+ let date = new Date();
+ date = date.addDays(1);
+ document.getElementById("comingsoon").innerHTML = "Coming " + date.toDateString();
+ </script>
+ <hr/>
+}
+
+templ faqPage() {
+ <h2>What are the instructions of h?</h2>
+ <p>h supports the following instructions:</p>
+ <ul>
+ <li><code>h</code></li>
+ <li><code>'</code></li>
+ </ul>
+ <p>All valid h instructions must be separated by a space (<code>\0x20</code> or the spacebar on your computer). No other forms of whitespace are permitted. Any other characters will render your program <a href="http://jbovlaste.lojban.org/dict/gentoldra">gentoldra</a>.</p>
+ <h2>How do I install and use h?</h2>
+ <p>With any computer running <a href="https://golang.org">Go</a> 1.11 or higher:</p>
+ <code><pre>go get -u -v within.website/x/cmd/hlang</pre></code>
+ Usage is simple:
+ <code><pre>{ usage }</pre></code>
+ <h2>What version is h?</h2>
+ <p>Version 1.0.1, this will hopefully be the only release.</p>
+ <h2>What is the h koan?</h2>
+ <p>And Jesus said unto the theologians, "Who do you say that I am?"</p>
+ <p>They replied: "You are the eschatological manifestation of the ground of our being, the kerygma of which we find the ultimate meaning in our interpersonal relationships."</p>
+ <p>And Jesus said "...What?"</p>
+ <p>Some time passed and one of them spoke "h".</p>
+ <p>Jesus was enlightened.</p>
+ <h2>Why?</h2>
+ <p>That's a good question. The following blogposts may help you understand this more:</p>
+ <ul>
+ <li><a href="https://xeiaso.net/blog/the-origin-of-h-2015-12-14">The Origin of h</a></li>
+ <li><a href="https://xeiaso.net/blog/formal-grammar-of-h-2019-05-19">A Formal Grammar of h</a></li>
+ </ul>
+ <h2>Who wrote h?</h2>
+ <p><a href="https://xeiaso.net">Within</a></p>
+}
+
+templ playgroundPage() {
+ <p><small>Unfortunately, Javascript is required to use this page, sorry.</small></p>
+ <h2>Program</h2>
+ <input id="program" type="text" value="h"/>
+ <input onClick="runProgram()" type="button" value="Run"/>
+ <p id="status"></p>
+ <h3>Output</h3>
+ <code><pre id="output"></pre></code>
+ <h4>AST</h4>
+ <code><pre id="ast_box"></pre></code>
+ <p>Execution time (nanoseconds): <span id="exec_time"></span></p>
+ <script>
+ function runProgram() {
+ const programData = document.getElementById("program").value;
+ const output = document.getElementById("output");
+ const astBox = document.getElementById("ast_box");
+ const execTime = document.getElementById("exec_time");
+ const status = document.getElementById("status");
+
+ status.innerHTML = "submitting to the server...";
+
+ postData("/api/playground", programData)
+ .then(function(data) {
+ if (data.err != null) {
+ status.innerHTML = data.err;
+ return;
+ }
+
+ status.innerHTML = "success";
+ astBox.innerHTML = data.prog.ast;
+ output.innerHTML = data.res.out;
+ execTime.innerHTML = data.res.exec_duration;
+ })
+ .catch(function(error) {
+ console.log(error);
+ status.innerHTML = error + ". Please try again later?";
+ });
+ }
+
+ function postData(url = "", data = "h") {
+ return fetch(url, {
+ method: "POST",
+ mode: "cors",
+ cache: "no-cache",
+ headers: {
+ "Content-Type": "text/plain",
+ },
+ referrer: "no-referrer",
+ body: data,
+ }).then(response => response.json());
+ }
+ </script>
+}
diff --git a/cmd/hlang/hlang_templ.go b/cmd/hlang/hlang_templ.go
new file mode 100644
index 0000000..81d01e8
--- /dev/null
+++ b/cmd/hlang/hlang_templ.go
@@ -0,0 +1,168 @@
+// Code generated by templ - DO NOT EDIT.
+
+// templ: version: v0.2.707
+package main
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import "context"
+import "io"
+import "bytes"
+
+func navbar() templ.Component {
+ return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a href=\"/\">The h programming language</a> - <a href=\"/docs\">Docs</a> - <a href=\"/play\">Playground</a> - <a href=\"/faq\">FAQ</a>")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func footer() templ.Component {
+ return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var2 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var2 == nil {
+ templ_7745c5c3_Var2 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<p>From <a href=\"https://xeiaso.net\">Within</a></p>")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func homePage() templ.Component {
+ return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var3 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var3 == nil {
+ templ_7745c5c3_Var3 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<p><big>A simple, fast, open-source, complete and safe language for developing modern software for the web</big></p><hr><h2>Example Program</h2><code><pre>h</pre></code><p>Outputs:</p><code><pre>h</pre></code><hr><h2>Fast Compilation</h2><p>h probably compiles hundreds of characters of source per second. I didn't really test how fast it is, but when I was testing it the speed was fast enough that I didn't care to profile it.</p><hr><h2>Safety</h2><p>h is completely memory safe with no garbage collector or heap allocations. It does not allow memory leaks to happen, nor do any programs in h have the possibility to allocate memory.</p><ul><li>No null</li><li>Completely deterministic behavior</li><li>No mutable state</li><li>No persistence</li><li>All functions are pure functions</li><li>No sandboxing required</li></ul><hr><h2>Zero* Dependencies</h2><p>h generates <a href=\"http://webassembly.org\">WebAssembly</a>, so every binary produced by the compiler is completely dependency free save a single system call: <code>h.h</code>. This allows for modern, future-proof code that will work on all platforms.</p><hr><h2>Simple</h2><p>h has a <a href=\"/grammar/h.peg\">simple grammar</a> that gzips to 117 bytes. Creating a runtime environment for h is so trivial just about anyone can do it.</p><hr><h2>Platform Support</h2><p>h supports the following platforms:</p><ul><li>Google Chrome</li><li>Electron</li><li>Chromium Embedded Framework</li><li>Microsoft Edge</li><li>Pa'i</li></ul><hr><h2>International Out of the Box</h2><p>h supports multiple written and spoken languages with true contextual awareness. It not only supports the Latin <code>h</code> as input, it also accepts the <a href=\"http://lojban.org\">Lojbanic</a> <code>'</code> as well. This allows for full 100% internationalization into Lojban should your project needs require it.</p><hr><h2>Testimonials</h2><p>Not convinced? Take the word of people we probably didn't pay for their opinion.</p><ul><li>I don't see the point of this.</li><li>This solves all my problems. All of them. Just not in the way I expected it to.</li><li>Yes.</li><li>Perfect.</li><li>h is the backbone of my startup.</li></ul><hr><h2>Open-Source</h2><p>The h compiler and default runtime are <a href=\"https://tulpa.dev/cadey/hlang\">open-source</a> free software sent out into the <a href=\"https://creativecommons.org/choose/zero/\">Public Domain</a>. You can use h for any purpose at all with no limitations or restrictions.</p><hr>")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func docsPage() templ.Component {
+ return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var4 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var4 == nil {
+ templ_7745c5c3_Var4 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<p><big id=\"comingsoon\">Coming soon...</big></p><script>\n Date.prototype.addDays = function(days) {\n var date = new Date(this.valueOf());\n date.setDate(date.getDate() + days);\n return date;\n }\n\n let date = new Date();\n date = date.addDays(1);\n document.getElementById(\"comingsoon\").innerHTML = \"Coming \" + date.toDateString();\n </script><hr>")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func faqPage() templ.Component {
+ return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ ctx