summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2021-05-14 14:15:30 -0500
committerColin Okay <okay@toyful.space>2021-05-14 14:15:30 -0500
commit6f881c35e820cc5704a930bbb238d252a87be5c1 (patch)
treed44e210666eb3fa0ba51605e0bed6f44b17db07d
parent69b8f1fd5dd3c57a637175a3e5c012c3bba3843a (diff)
more approrpiate naming in template and artifact macros
-rw-r--r--flexo.lisp37
1 files changed, 27 insertions, 10 deletions
diff --git a/flexo.lisp b/flexo.lisp
index 49788a9..166ffc6 100644
--- a/flexo.lisp
+++ b/flexo.lisp
@@ -264,40 +264,57 @@ artifact tables have changed."
;;; ARTIFACT TEMPLATE AND CREATION MACROS
-(defmacro spinneret-page (url &body body)
+(defmacro spinneret-page (url &body spinneret-code)
"Creates a SPINNERET-PAGE instance with the given url path by
expanding the SPINNERET template in BODY."
- (let ((body (inject-autorefresh-into-spinneret-body body)))
+ (let ((body (inject-autorefresh-into-spinneret-body spinneret-code)))
`(make-instance
'spinneret-page
:url ,url
:text (with-html-string ,@body))))
+(defmacro define-spinneret-page (pagename url-string &body spinneret-code)
+ "Defines a function of zero arguments that creates a SPINNERET-PAGE
+ artifact with the provided URL-STRING by expanding the SPINNERET
+ template in BODY. Suitable for defining single-pages that can be
+ called within a recipe."
+ `(defun ,pagename ()
+ (spinneret-page ,url-string ,@spinneret-code)))
+
(defmacro define-spinneret-template
- (template-name (url-arg &rest lambda-list-def) &body template-body)
+ (template-name (url-arg &rest lambda-list-def) &body spinneret-code)
"Defines a function that creates an instance of SPINNERET-PAGE from a
reusable template."
`(defun ,template-name (,url-arg ,@lambda-list-def)
(spinneret-page ,url-arg
- ,@template-body)))
+ ,@spinneret-code)))
-(defmacro ps-script (url &body body)
+(defmacro ps-script (url &body parenscript-code)
"Creates a PS-SCRIPT instance with given URL by expanding the
PARENSCRIPT template in BODY."
`(make-instance
'ps-script
:url ,url
- :text (ps:ps ,@body)))
+ :text (ps:ps ,@parenscript-code)))
+
+(defmacro define-ps-script (name url-string &body parenscript-code)
+ `(defun ,name ()
+ (ps-script ,url-string
+ ,@parenscript-code)))
-(defmacro lass-sheet (url &body body)
+(defmacro lass-sheet (url &body lass-code)
"Creates a LASS-SHEET instance with URL by expanding the LASS template in BODY."
`(make-instance
'lass-sheet
:url ,url
- :text (lass:compile-and-write ,@body)))
+ :text (lass:compile-and-write ,@lass-code)))
+
+(defmacro define-lass-sheet (name url &body lass-code)
+ `(defun ,name ()
+ (lass-sheet ,url ,@lass-code)))
(defmacro define-lass-template
- (template-name (url-arg &rest keyword-args) &body template-body)
+ (template-name (url-arg &rest keyword-args) &body lass-code)
"Defines a function that produces an instance of LASS-SHEET from a
reusable template.
@@ -317,7 +334,7 @@ artifact tables have changed."
`(defun ,template-name (,url-arg &key ,@keyword-args)
(lass-sheet ,url-arg
(list* :let (mapcar #'list ',arg-names (list ,@arg-names))
- ',template-body)))))
+ ',lass-code)))))
(defclass file-artifact (artifact file) ()
(:documentation