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-22 06:37:20 +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-21 23:41:12 +09:00
|
|
|
(pi:elem-str (cmp:document :metadata metadata
|
2024-04-19 13:04:30 +09:00
|
|
|
(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-21 19:09:58 +09:00
|
|
|
(pi:elem-str (cmp:partial-document component))))
|