summaryrefslogtreecommitdiff
path: root/.zs
diff options
context:
space:
mode:
Diffstat (limited to '.zs')
-rw-r--r--.zs/components/buttons.jq2
-rwxr-xr-x.zs/components/footer109
-rwxr-xr-x.zs/components/nav48
-rwxr-xr-x.zs/components/wavy30
-rwxr-xr-x.zs/components/webring49
-rw-r--r--.zs/layout.html15
-rwxr-xr-x.zs/list2
-rwxr-xr-x.zs/styles58
8 files changed, 209 insertions, 104 deletions
diff --git a/.zs/components/buttons.jq b/.zs/components/buttons.jq
index 3d52602..9a135e0 100644
--- a/.zs/components/buttons.jq
+++ b/.zs/components/buttons.jq
@@ -1,3 +1,3 @@
include ".zs/components/get_filename";
-map("<a href=\"\(.link)\"><img src=\"\($BUTTONS_DIR + (. | filename))\" alt=\"An 88x31 button. \(.alt)\" title=\"\(.title)\"></a>") | join("\n")
+map("<a href=\"\(.link)\"><img src=\"\($BUTTONS_DIR + (. | filename))\" alt=\"An 88x31 button. \(.alt)\" title=\"\(.title)\"><div class=\"icon\"><img src=\"/assets/svg/external.svg\"></div><div class=\"link\">\(.link)</div></a>") | join("\n")
diff --git a/.zs/components/footer b/.zs/components/footer
index 0c0fa63..0a8b019 100755
--- a/.zs/components/footer
+++ b/.zs/components/footer
@@ -10,82 +10,43 @@ print(html {
{
tag = "div",
{
- tag = "span",
- {
- tag = "a",
- class = "volatile",
- href = "https://ring.acab.dev/prev/C1NMCp8IXr",
- title = "go to the previous page in the webring",
- "[<<]"
- }
- },
- {
- tag = "span",
- {
- tag = "a",
- class = "volatile",
- href = "https://ring.acab.dev/rand/C1NMCp8IXr",
- title = "go to a random page in the webring",
- "[?]"
- }
- },
- {
- tag = "span",
- {
- tag = "a",
- class = "volatile",
- href = "https://ring.acab.dev",
- title = "hacker webring",
- "[⠠⠵ ]"
- }
- },
- {
- tag = "span",
- {
- tag = "a",
- class = "volatile",
- href = "https://ring.acab.dev/next/C1NMCp8IXr",
- title = "go to the next page in the webring",
- "[>>]"
- }
- },
- },
- {
- tag = "div",
- {
- tag = "span",
- "made with ",
+ tag = "div",
{
tag = "span",
- style = "color: var(--red)",
- "<3"
- },
- " by darkuss"
- },
- {
- tag = "span",
- {
- tag = "a",
- href = "/credits.html",
- "credits"
- }
- },
- {
- tag = "span",
- {
- tag = "a",
- href = "/privacy.html",
- "privacy"
- }
- },
- {
- tag = "span",
- "last modified: ",
- {
- tag = "time",
- datetime = date,
- date
+ "made with ",
+ {
+ tag = "span",
+ style = "color: var(--red)",
+ "<3"
+ },
+ " by darkuss"
+ },
+ {
+ tag = "span",
+ {
+ tag = "a",
+ href = "/credits.html",
+ "credits"
+ }
+ },
+ {
+ tag = "span",
+ {
+ tag = "a",
+ href = "/privacy.html",
+ "privacy"
+ }
+ },
+ {
+ tag = "span",
+ "built on: ",
+ {
+ tag = "time",
+ datetime = date,
+ date
+ }
+ }
}
}
}
-})
+)
diff --git a/.zs/components/nav b/.zs/components/nav
index 9ec3453..e2ff283 100755
--- a/.zs/components/nav
+++ b/.zs/components/nav
@@ -3,24 +3,49 @@
package.path = ".zs/?.lua;" .. package.path
local html = require "components.html"
+---@alias Set table<any, true>
+
+---@param t any[]
+---@return Set
+local function set(t)
+ local tmp = {}
+ for _, value in ipairs(t) do
+ tmp[value] = true
+ end
+ return tmp
+end
+
---@class Link
---@field url string
---@field title string
---@field index boolean?
+---@field dir string?
+---@field inside Set?
---@type Link[]
local links = {
{
url = "/",
title = "home",
+ inside = set {
+ "index"
+ }
},
{
url = "/projects.html",
- title = "projects"
+ title = "projects",
+ inside = set {
+ "prismite"
+ }
},
{
url = "/posts.html",
- title = "ramblings"
+ title = "ramblings",
+ dir = "blog"
+ },
+ {
+ url = "/buttons.html",
+ title = "buttons"
},
{
url = "/rss.xml",
@@ -28,28 +53,37 @@ local links = {
}
}
+---@param path string
+---@return string, integer
local function get_file_stem(path)
return path
:gsub(".[^.]*$", "") -- get rid of ext
:gsub(".*/", "") -- get rid of prefix
end
-local current_file = get_file_stem(os.getenv("ZS_FILE"))
+local current_path = assert(os.getenv("ZS_FILE"))
+local current_file = get_file_stem(current_path)
local acc = {}
for _, link in ipairs(links) do
local title = link.title
- if current_file == get_file_stem(link.url) or current_file == "index" and link.url == "/" then
- title = "[" .. title .. "]"
+ local class = "tab"
+ if
+ current_file == get_file_stem(link.url) or
+ link.inside and link.inside[current_file] or
+ link.dir and current_path:match(link.dir .. "/") ~= nil
+ then
+ class = class .. " active"
end
table.insert(acc, {
tag = "li",
+ class = class,
{
tag = "a",
href = link.url,
- title
+ title,
}
})
end
@@ -59,5 +93,5 @@ print(html {
{
tag = "ul",
acc
- }
+ },
})
diff --git a/.zs/components/wavy b/.zs/components/wavy
new file mode 100755
index 0000000..645442e
--- /dev/null
+++ b/.zs/components/wavy
@@ -0,0 +1,30 @@
+#!/usr/bin/lua
+
+package.path = ".zs/?.lua;" .. package.path
+local html = require "components.html"
+
+-- select what message to use
+local name = arg[1]
+
+local TEXT = {
+ hey = "hey there!",
+ ["404"] = "alas, there is nothing to be found here"
+}
+
+local acc = {}
+
+local i = 0
+for char in TEXT[name or "hey"]:gmatch(".") do
+ table.insert(acc, {
+ tag = "span",
+ style = "animation-delay:" .. (-800 * i) .. "ms",
+ char
+ })
+ i = i + 1
+end
+
+print(html {
+ tag = "div",
+ class = "wavy",
+ acc
+})
diff --git a/.zs/components/webring b/.zs/components/webring
new file mode 100755
index 0000000..375b6c7
--- /dev/null
+++ b/.zs/components/webring
@@ -0,0 +1,49 @@
+#!/usr/bin/lua
+
+package.path = ".zs/?.lua;" .. package.path
+local html = require "components.html"
+
+print(html {
+ tag = "div",
+ class = "webring",
+ {
+ tag = "span",
+ {
+ tag = "a",
+ class = "volatile",
+ href = "https://ring.acab.dev/prev/C1NMCp8IXr",
+ title = "go to the previous page in the webring",
+ "[<<]"
+ }
+ },
+ {
+ tag = "span",
+ {
+ tag = "a",
+ class = "volatile",
+ href = "https://ring.acab.dev/rand/C1NMCp8IXr",
+ title = "go to a random page in the webring",
+ "[?]"
+ }
+ },
+ {
+ tag = "span",
+ {
+ tag = "a",
+ class = "volatile",
+ href = "https://ring.acab.dev",
+ title = "hacker webring",
+ "[⠠⠵ ]"
+ }
+ },
+ {
+ tag = "span",
+ {
+ tag = "a",
+ class = "volatile",
+ href = "https://ring.acab.dev/next/C1NMCp8IXr",
+ title = "go to the next page in the webring",
+ "[>>]"
+ }
+ },
+})
diff --git a/.zs/layout.html b/.zs/layout.html
index 21ccc0b..4893239 100644
--- a/.zs/layout.html
+++ b/.zs/layout.html
@@ -24,16 +24,9 @@
</head>
<body>
- <div id="deco" aria-hidden=true>
- <div id="rainbow"></div>
- <div id="triangles"></div>
- </div>
- <div id="upper" role="presentation">
- {{ .zs/components/nav }}
- <div>
- <main><div>{{ content }}</div></main>
- {{ .zs/components/footer }}
- </div>
- </div>
+ <div id="triangles"></div>
+ {{ .zs/components/nav }}
+ <main><div>{{ content }}</div></main>
+ {{ .zs/components/footer }}
</body>
</html>
diff --git a/.zs/list b/.zs/list
index 854eab0..8ebee3a 100755
--- a/.zs/list
+++ b/.zs/list
@@ -74,7 +74,7 @@ EOF
href="/$dir/$(basename "${md_file%.md}.html")"
# Append to the HTML list
- html="$html<li><a href=\"$href\">$title</a><span class="subtle">(published: <time datetime=$formatted_date>$formatted_date</time>)</span></li>"
+ html="$html<li><a href=\"$href\">$title</a><span>(published: <time datetime=$formatted_date>$formatted_date</time>)</span></li>"
done
html="$html</ol>"
diff --git a/.zs/styles b/.zs/styles
index c51a369..bbe31ba 100755
--- a/.zs/styles
+++ b/.zs/styles
@@ -1,14 +1,52 @@
-#!/bin/sh
+#!/usr/bin/lua
-set -e
+---@class Stylesheet
+---@field name string
+---@field lazy? boolean
-CSS="reset main"
-CSS_ZS_FILE=$(echo $ZS_FILE | sed -e 's/.[^.]*$/.css/')
+---@type Stylesheet[]
+local stylesheets = {
+ {
+ name = "reset",
+ },
+ {
+ name = "main",
+ },
+ {
+ name = "content",
+ lazy = true
+ },
+ {
+ name = "deco",
+ lazy = true
+ }
+}
-for css in $CSS; do
- printf "<link rel=\"stylesheet\" href=\"/assets/css/%s.css\">\n" "$css"
-done
+---@param path string
+---@return string, integer
+local function get_file_stem(path)
+ return path
+ :gsub(".[^.]*$", "") -- get rid of ext
+ :gsub(".*/", "") -- get rid of prefix
+end
-if [ -f $(printf "assets/css/%s" "$CSS_ZS_FILE") ]; then
- printf "<link rel=\"stylesheet\" href=\"/assets/css/%s\">\n" "$CSS_ZS_FILE"
-fi
+local current_path = assert(os.getenv("ZS_FILE"))
+local current_file = get_file_stem(current_path)
+
+local f = io.open("assets/css/" .. current_file .. ".page.css")
+if f ~= nil then
+ f:close()
+ table.insert(stylesheets, {
+ name = current_file .. ".page"
+ })
+end
+
+for _, stylesheet in ipairs(stylesheets) do
+ local content = [[link rel="stylesheet" href="/assets/css/]] .. stylesheet.name .. [[.css"]]
+ if stylesheet.lazy then
+ print("<" .. content .. [[ media="print" onload="this.media='all'; this.onload = null">]])
+ print("<noscript><" .. content .. "></noscript>")
+ else
+ print("<" .. content .. ">")
+ end
+end