commit a386ddb2979cd75bf9a4b7501830209de9e248d5 Spenser Truex <truex@equwal.com> 2025-09-01 16:38:10 -0400 Move macros to early loading
cl-yag.asd | 2 +- generator-aux.lisp | 15 --------------- generators-util.lisp | 9 +++++++++ generators/html.lisp | 6 ------ 4 files changed, 10 insertions(+), 22 deletions(-)
diff --git a/cl-yag.asd b/cl-yag.asd index b11ed99..fb09462 100644 --- a/cl-yag.asd +++ b/cl-yag.asd @@ -8,10 +8,10 @@ :serial t :components ((:file "packages") (:file "generators-util") + (:file "generator-aux-pre") (:file "generators/html") (:file "generators/gopher") (:file "generators/gemini") - (:file "generator-aux-pre") (:file "data/articles") (:file "generator-aux") )) diff --git a/generator-aux.lisp b/generator-aux.lisp index 6f4fb7a..2ff43af 100644 --- a/generator-aux.lisp +++ b/generator-aux.lisp @@ -48,21 +48,6 @@ (with-open-file (stream path :direction :output :if-exists :supersede :if-does-not-exist :create) (write-sequence data stream))) -(defmacro prepare(template &body code) - "Simplify the declaration of a new page type by loading a template and executing code." - `(progn - (let ((output (load-file ,template))) - ,@code - output))) - -(defmacro with-converter(&body code) - "Get the converter object for an article and execute code in that context." - `(progn - (let ((converter-name (or (article-converter article) - (getf *config* :default-converter)))) - (let ((converter-object (getf *converters* converter-name))) - ,@code)))) - (defun date-format(format date) "Format a date using the given format string with template substitutions." (let ((output format)) diff --git a/generators-util.lisp b/generators-util.lisp index b4eeb26..3ea2ccf 100644 --- a/generators-util.lisp +++ b/generators-util.lisp @@ -18,3 +18,12 @@ (getf *config* :default-converter)))) (let ((converter-object (getf *converters* converter-name))) ,@code)))) + +(defmacro prepare(template &body code) + "Simplify the declaration of a new page type by loading a template and executing code." + `(progn + (let ((output (load-file ,template))) + ,@code + output))) + + diff --git a/generators/html.lisp b/generators/html.lisp index 1c5f06c..62ff036 100644 --- a/generators/html.lisp +++ b/generators/html.lisp @@ -85,12 +85,6 @@ (template "%%Body%%" body) output)) -;; simplify the file saving by using the layout -(defmacro generate(name &body data) - `(progn - (save-file ,name (generate-layout ,@data)))) - - ;; generates the html of only one article ;; this is called in a loop to produce the homepage (defun create-article(article &optional &key (tiny t) (no-text nil))