From 838ba097a4a2b8af5267924d546af15131ba5c4d Mon Sep 17 00:00:00 2001 From: cage Date: Sat, 14 Dec 2024 15:10:53 +0100 Subject: [PATCH] - [script] capitalized gemlog link labels. --- data/scripts/generate-gemlog.lisp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/data/scripts/generate-gemlog.lisp b/data/scripts/generate-gemlog.lisp index 0eaa4a5..252c162 100644 --- a/data/scripts/generate-gemlog.lisp +++ b/data/scripts/generate-gemlog.lisp @@ -345,11 +345,18 @@ (defun write-links (posts stream) (flet ((clean-link-filename (filename) - (cl-ppcre:regex-replace "\\.gmi$" - (cl-ppcre:regex-replace-all "-" - filename - " ") - ""))) + (let* ((basename (cl-ppcre:regex-replace "\\.gmi$" filename "")) + (words (cl-ppcre:split "-" basename)) + (capitalized-words (loop for ct from 0 + for word in words + collect + (if (or (= ct 0) + (> (length word) 3)) + (let ((first-char (string-capitalize (elt word 0)))) + (text-utils:strcat first-char + (subseq word 1))) + word)))) + (text-utils:join-with-strings capitalized-words " ")))) (loop for post in posts do (let* ((filename (strip-dirs-from-path (archive-file-path post))) (relative-archive-path (strcat *uri-path-prefix*