summaryrefslogtreecommitdiff
path: root/pages.lisp
blob: 7bbf48b14293f10b3e1f6da176e55aa99a4c3fff (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
26
27
28
29
30
;;;; pages.lisp -- html generation functions for dnd

(defmacro with-page ((&key title) &body body)
  `(with-html-string
     (:doctype)
     (:html
      (:head
       (:title ,title))
      (:body ,@body))))

(defun a-hero-is-born ()
  (with-page (:title "A Hero Is Born!")
    (:header
     (:h1 "A Hero Is Materializing From the Void..."))
    (:form :method "POST" :action "/a-hero-is-born"
	   (:label :for "NAME" "Thy Hero's Appelation")
	   (:input :name "NAME")
	   (:button :type "submit"))))

(defun doorkeeper ()
  (with-page (:title "Tavern Door")
    (:h1 "Wot's yer name 'ero?")
    (:form :method "POST" :action "/tavern-door"
	   (:label :for "NAME" "Thy Hero's Appelation")
	   (:input :name "NAME")
	   (:button :type "submit"))))

(defun tavern (hero)
  (with-page (:title "A Bustling Tavern")
    (:h1 "Aye! Welcome " (hero-name hero))))