blob: 71f07b4c700f408b0087facd26d951a9ec8da0b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
;;;; render.lisp -- render protocol and tools
(in-package :dnd)
(defgeneric render (view object &key)
(:documentation "Render OBJECT as VIEW. VIEW could be anything, but it is intended to
be a keyword for usin in EQL method specializers."))
(defmacro defrender (view (spec &rest kwargs) &body body)
"A helper macro for defining specializations of render."
(let ((viewvar (gensym)))
`(defmethod render ((,viewvar ,(if (eq t view) t `(eql ,view))) ,spec &key ,@kwargs)
,@body)))
(defmacro with-page ((&key title) &body body)
"A helper macro fordefining some standard page boilerplate."
(let ((title-var (gensym)))
`(let ((,title-var ,title))
(with-html-string
(:doctype)
(:html
(:head
(:title ,title-var))
(:body
,@body))))))
|