summaryrefslogtreecommitdiff
path: root/pages.lisp
blob: 6d2656547d2925955f05157c93d750751e30b765 (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
31
32
33
34
;;;; pages.lisp -- html generation functions for dnd

(in-package :dnd)

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

(defun godess-shrine ()
  (with-page (:title "A Sacred Shrine")
    (:header
     (:h1 "Pray and become a hero..."))
    (:form :method "POST" :action "/godess-shrine"
	   (:label :for "NAME" "Enter the epithet thy hero shall be called:")
	   (:input :name "NAME")
	   (:button :type "submit" "Pry To The Goddess"))))

(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" "Enter"))
    (:h2 "Eh? Ye need to birth a new hero?")
    (:a :href "/godess-shrine" "Follow me...")))

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