spacepaste

  1.  
  2. (defpackage "WHO-EXAMPLE" (:use "CL" "CL-WHO"))
  3. (in-package "WHO-EXAMPLE")
  4. (defvar *who-stream*)
  5. (defun some-snippet (content &optional (stream *who-stream*))
  6. (with-html-output (stream)
  7. (:div :class "snippet" (esc content))))
  8. (defun stuff ()
  9. (with-html-output-to-string (*who-stream*)
  10. (:body
  11. (loop for i from 1 to 10
  12. do (some-snippet (format nil "A snippet ~D" i))))))
  13. ;; (stuff) =>
  14. ;; "<body><div class='snippet'>A snippet 1</div><div class='snippet'>A snippet 2</div><div class='snippet'>A snippet 3</div><div class='snippet'>A snippet 4</div><div class='snippet'>A snippet 5</div><div class='snippet'>A snippet 6</div><div class='snippet'>A snippet 7</div><div class='snippet'>A snippet 8</div><div class='snippet'>A snippet 9</div><div class='snippet'>A snippet 10</div></body>"
  15.