2024-04-19 22:00:46 +09:00
|
|
|
(defpackage #:hp/view/renderer
|
2024-04-19 13:04:30 +09:00
|
|
|
(:use #:cl)
|
|
|
|
(:local-nicknames (#:jg #:jingle))
|
|
|
|
(:local-nicknames (#:pi #:piccolo))
|
2024-04-19 22:00:46 +09:00
|
|
|
(:local-nicknames (#:cfg #:hp/config))
|
2024-04-20 07:45:44 +09:00
|
|
|
(:local-nicknames (#:cmp #:hp/view/components/*))
|
2024-04-19 13:04:30 +09:00
|
|
|
(:export #:render
|
|
|
|
#:partial-render))
|
2024-04-19 22:00:46 +09:00
|
|
|
(in-package #:hp/view/renderer)
|
2024-04-19 13:04:30 +09:00
|
|
|
|
|
|
|
(defun render (page &key status metadata)
|
|
|
|
(jg:with-html-response
|
2024-04-20 07:45:44 +09:00
|
|
|
(if status (jg:set-response-status status))
|
2024-04-19 13:04:30 +09:00
|
|
|
(pi:elem-str (cmp:document metadata
|
|
|
|
(cmp:layout page)))))
|
|
|
|
|
|
|
|
(defun partial-render (component &key status)
|
|
|
|
(jg:with-html-response
|
2024-04-20 07:45:44 +09:00
|
|
|
(if status (jg:set-response-status status))
|
2024-04-19 13:04:30 +09:00
|
|
|
(pi:elem-str component)))
|