commit 12a3d7e16c0160d371c232c99b9cd983c590fdbd Author: Eduard Urbach Date: Sun Mar 31 20:43:49 2024 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..77841f3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +* +!*/ +!.gitignore +!*.go +!*.md +!*.mod +!*.sum +!*.html +!*.css \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..19d0029 --- /dev/null +++ b/go.mod @@ -0,0 +1,7 @@ +module git.akyoto.dev/web/akyoto.dev + +go 1.22.1 + +require git.akyoto.dev/go/web v0.0.0-20240330085437-b28a9f12ce73 + +require git.akyoto.dev/go/router v0.1.4 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..78b1810 --- /dev/null +++ b/go.sum @@ -0,0 +1,6 @@ +git.akyoto.dev/go/assert v0.1.3 h1:QwCUbmG4aZYsNk/OuRBz1zWVKmGlDUHhOnnDBfn8Qw8= +git.akyoto.dev/go/assert v0.1.3/go.mod h1:0GzMaM0eURuDwtGkJJkCsI7r2aUKr+5GmWNTFPgDocM= +git.akyoto.dev/go/router v0.1.4 h1:ZL5HPl4aNn4QKihf3VVs0Mm9R6ZGn2StAHGRQxjEbws= +git.akyoto.dev/go/router v0.1.4/go.mod h1:rbHbkLJlQOafuOuvBalO3O8E0JtMFPT3zzTKX3h9T08= +git.akyoto.dev/go/web v0.0.0-20240330085437-b28a9f12ce73 h1:xSllT0LSYqFr3mhN1T/EZFAdQoHrPbQerZAPhEgQnHo= +git.akyoto.dev/go/web v0.0.0-20240330085437-b28a9f12ce73/go.mod h1:oB/+nfWbAsBXYhV+TidUjmxdbyGpU7pODdo95bYaRVc= diff --git a/main.go b/main.go new file mode 100644 index 0000000..3fed544 --- /dev/null +++ b/main.go @@ -0,0 +1,38 @@ +package main + +import ( + "fmt" + "os" + "strings" + + "git.akyoto.dev/go/web" + "git.akyoto.dev/go/web/send" +) + +func main() { + html := mustLoad("public/app.html") + css := mustLoad("public/app.css") + body := mustLoad("public/body.html") + layout := strings.Replace(html, "%head%", fmt.Sprintf("", css), 1) + + s := web.NewServer() + + s.Get("/", func(ctx web.Context) error { + return send.HTML(ctx, strings.Replace(layout, "%body%", body, 1)) + }) + + s.Run(":8080") +} + +func mustLoad(path string) string { + dataBytes, err := os.ReadFile(path) + + if err != nil { + panic(err) + } + + data := string(dataBytes) + data = strings.ReplaceAll(data, "\t", "") + data = strings.ReplaceAll(data, "\n", "") + return data +} diff --git a/public/app.css b/public/app.css new file mode 100644 index 0000000..1e0e65d --- /dev/null +++ b/public/app.css @@ -0,0 +1,190 @@ +:root { + --main-hue: 40; + --main-saturation: 100%; + --main-color: hsl(var(--main-hue), var(--main-saturation), 70%); + --link-color: hsl(var(--main-hue), var(--main-saturation), 75%); + --header-color: hsl(0, 0%, 100%); + --text-color: hsl(0, 0%, 77%); + --grey-color: hsl(0, 0%, 61%); + --highlight-color: hsla(0, 0%, 100%, 0.05); + --body-color: hsl(220, 5%, 12%); + --font-family: system-ui, sans-serif; + --font-family-mono: monospace; + --font-size: 18px; + --line-height: 1.6; + --max-width: 65ch; + --padding: 0.78571429em 0.92857143em; + --border-radius: 5px; + --gap: 1em; +} + +* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +html { + height: 100%; +} + +body { + display: flex; + flex-direction: column; + align-items: center; + height: 100%; + overflow-x: hidden; + overflow-y: scroll; + font-family: var(--font-family); + font-size: var(--font-size); + line-height: var(--line-height); + color: var(--text-color); + background-color: var(--body-color); + word-break: break-word; + tab-size: 4; +} + +main, +section, +article { + display: flex; + flex-direction: column; + gap: var(--gap); +} + +a { + color: var(--link-color); + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +ul, +ol { + list-style-position: inside; +} + +pre { + white-space: pre-wrap; +} + +blockquote, +pre { + padding: var(--padding); + border-radius: var(--border-radius); + background-color: var(--highlight-color); +} + +blockquote p::before { + content: "\201C"; +} + +blockquote p::after { + content: "\201D"; +} + +h1 { + color: white; + font-size: 2.2rem; + letter-spacing: -0.02em; +} + +h2 { + color: var(--header-color); + font-size: 1.8rem; + margin-top: var(--gap); + padding-bottom: var(--gap); + border-bottom: 1px solid var(--highlight-color); +} + +h3 { + color: var(--header-color); + font-size: 1.3rem; + font-weight: normal; +} + +hr { + border-top: none; + border-bottom: 1px solid var(--highlight-color); +} + +th, +td { + width: 50%; + text-align: left; +} + +th { + border-bottom: 1px solid var(--highlight-color); +} + +th:empty { + display: none; +} + +@media (min-width: 800px) { + h2 { + margin-left: -1rem; + } + + .post-header { + margin-left: -1rem; + } + + .post-time { + margin-left: 0.5rem; + } +} + +code { + font-family: var(--font-family-mono); + word-break: break-word; +} + +.comment { + color: gray; + font-style: italic; +} + +.char, +.string { + color: greenyellow; +} + +.keyword { + color: var(--link-color); +} + +.function { + color: var(--link-color); +} + +.builtin { + color: #fffab5; +} + +.number { + color: cyan; +} + +.variable { + color: gray; +} + +.parameter { + color: orange; +} + +.section { + color: lightgreen; +} + +.operator { + color: white; +} + +.punctuation { + color: gray; +} \ No newline at end of file diff --git a/public/app.html b/public/app.html new file mode 100644 index 0000000..0c4b284 --- /dev/null +++ b/public/app.html @@ -0,0 +1,12 @@ + + + + + + + %head% + + + %body% + + \ No newline at end of file diff --git a/public/body.html b/public/body.html new file mode 100644 index 0000000..d320562 --- /dev/null +++ b/public/body.html @@ -0,0 +1,65 @@ + + + + + + +
+ +
+
+ Test. +
+ \ No newline at end of file