Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 088d90e17c
Fetching contributors…

Cannot retrieve contributors at this time

file 18 lines (15 sloc) 0.768 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
(in-package #:cliki2)

(defmacro %defpage (page method parameters &body body)
  (let ((page-uri (symbol-name (if (listp page) (car page) page))))
       (pushnew (list ,page-uri) %defined-uris :test #'equal)
       (define-easy-handler (,(if (listp page) (cadr page) page) :uri ,(string-downcase page-uri) :default-request-type ,method) ,parameters

(defmacro defpage (page title parameters &body body)
  `(%defpage ,page :both ,parameters
     (render-page ,title ,@body)))

(defmacro defhandler (page parameters &body body)
  `(%defpage ,page :post ,(mapcar (lambda (p)
                                    (list p :request-type :both))
     (redirect (or (progn ,@body) "/") :code 303)))
Something went wrong with that request. Please try again.