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 +++++++++++++++++++++ .zs/layout.html | 15 ++----- .zs/list | 2 +- .zs/styles | 58 +++++++++++++++++++----- 8 files changed, 209 insertions(+), 104 deletions(-) create mode 100755 .zs/components/wavy create mode 100755 .zs/components/webring (limited to '.zs') 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", + "[>>]" + } + }, +}) 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 @@ - - +
+ {{ .zs/components/nav }} +
{{ content }}
+ {{ .zs/components/footer }} 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
  • $title(published: )
  • " + html="$html
  • $title(published: )
  • " done html="$html" 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 "\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 "\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("") + else + print("<" .. content .. ">") + end +end -- cgit v1.2.3