From 95ceed33d3adec472f4a1b5d3517baf645766e44 Mon Sep 17 00:00:00 2001 From: delta Date: Sat, 25 Jul 2026 11:42:01 +0200 Subject: site rework!! --- .zs/components/buttons.jq | 2 +- .zs/components/footer | 109 +++++++++++++++------------------------------- .zs/components/nav | 48 +++++++++++++++++--- .zs/components/wavy | 30 +++++++++++++ .zs/components/webring | 49 +++++++++++++++++++++ 5 files changed, 156 insertions(+), 82 deletions(-) create mode 100755 .zs/components/wavy create mode 100755 .zs/components/webring (limited to '.zs/components') 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("\"An") | join("\n") +map("\"An
\(.link)
") | 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 + +---@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", + "[>>]" + } + }, +}) -- cgit v1.2.3