ethica

Spinozas ethics and various translations, edited for easy post processing.
git clone https://git.repetitions.de/ethica
commit 5952f1c240a48a36d4b6d60fe94b23cbb72be546
parent 2e62160b0e1740dca9e3fb07f5fa57e3981e4986
Author: lou woell <lou@repetitions.de>
Date:   Fri, 23 Oct 2026 22:06:03 +0200

cache templates

Diffstat:
Mlisp/ethics.lisp | 18+++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/lisp/ethics.lisp b/lisp/ethics.lisp @@ -15,6 +15,18 @@ :data-dir #p"../data/" :versions ("en_elwes" "la_spinoza"))) +(defvar *template-cache* (make-hash-table)) + +(defun get-template (template config) + (declare (type pathname template)) + (plump:clone-node + (uiop:ensure-gethash + template *template-cache* + (lambda () + (let ((path (merge-pathnames template (getf config :template-dir)))) + (plump:parse path)))))) + + (defun read-version (key dir tbl) (format t "Reading: ~a~&" key) (loop :with meta := nil @@ -95,7 +107,7 @@ (defun make-node (node vkey types &optional (level 0)) (clip:process - (merge-pathnames #p"node.chtml" (getf config :template-dir)) + (get-template #p"node.chtml" config) :node node :level (1+ (or level 0)) :vkey vkey @@ -110,14 +122,14 @@ (destructuring-bind (ethica &rest versions) (import-ethics config) (process-to-file - (merge-pathnames #p"index.chtml" (getf config :template-dir)) + (get-template #p"index.chtml" config) (merge-pathnames #p"index.html" (getf config :build-dir)) :versions versions) (dolist (version versions) (let ((key (getf version :key))) (format t "Writing: ~a~&" key) (process-to-file - (merge-pathnames #p "ethics.chtml" (getf config :template-dir)) + (get-template #p "ethics.chtml" config) (merge-pathnames (getf version :file) (getf config :build-dir)) :tree (gethash "ethica" ethica)