cripslock

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit f514164bed33fcdc51de6a60b020e1df527e44c2
parent 9c5255940139af2c8c70cb7fb56e5c5abf02b149
Author: Daniel Barlow <dan@telent.net>
Date:   Fri,  8 Aug 2025 19:08:33 +0100

improve image rendering

- add boxy for a lightbox thing
- mix css in so that they default to a sensible size

Diffstat:
Mmain.fnl | 11++++++++++-
Msite.fnl | 3+++
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/main.fnl b/main.fnl @@ -77,9 +77,18 @@ (fn page-header [stream title] (stream:write_chunk (string.format - " <!DOCTYPE html>\n<html><head><link href=\"/static/css/default.css\" rel=\"stylesheet\"><link href=\"/news.rss\" rel=\"alternate\" title=\"RSS\" type=\"application/rss+xml\"><title>%s @ telent</title></head> + "<!DOCTYPE html>\n<html><head> +<link href=\"/static/css/default.css\" rel=\"stylesheet\"> +<link href=\"/static/css/boxy.css\" rel=\"stylesheet\"> +<link href=\"/news.rss\" rel=\"alternate\" title=\"RSS\" type=\"application/rss+xml\"><title>%s @ telent</title> +<script src=\"/static/boxy.js\" ></script> +<style> +img.floated { width: 40%%; float: right; border: 1px #555 solid; background-color: #eee; padding: 2px; } +</style> +</head> <body> <header><a href=\"/\"><div class=\"title\">diary @ telent</div></a></header> +<div id=boxy></div> <article>" title))) diff --git a/site.fnl b/site.fnl @@ -27,6 +27,9 @@ }) (string.gsub "([%s\n>])(https-%:%/%/.-)([%s\n<])" #(%% "%s <a href=%q>%s</a> %s" $1 $2 $2 $3)) + ;; this is brittle and yuck + (string.gsub "<img src=" "<img class=\"boxyimg floated\" src=") + (string.gsub "%[%[([%w_-]+)|(.-)%]%]" subst-links) (string.gsub "%[%[([%w_-]+)%]%]" subst-links))))