Skip to content

Instantly share code, notes, and snippets.

@joekarma
Created April 4, 2013 16:00
Show Gist options
  • Save joekarma/5311681 to your computer and use it in GitHub Desktop.
Save joekarma/5311681 to your computer and use it in GitHub Desktop.
;; cl-who
(let ((colors '("red" "green" "blue")))
(who:with-html-output-to-string (s)
(:html
(:head
(:title "Colors"))
(:body
(:ul
(dolist (c colors)
(who:htm (:li (who:str c)))))))))
;; yaclml
(let ((colors '("red" "green" "blue")))
(yaclml:with-yaclml-output-to-string
(<:html
(<:head
(<:title "Colors"))
(<:body
(<:ul
(dolist (c colors)
(<:li (<:as-html c))))))))
;; yaclml makes it easier to move snippets to functions
;; It can also do this while preserving indentation, if that's important to you.
(let ((colors '("red" "green" "blue")))
(yaclml:with-yaclml-output-to-string
(<:html
(<:head
(<:title "Colors"))
(<:body
(<:ul
(dolist (c colors)
(yaclml-list-item c)))))))
(defun yaclml-list-item (c)
(<:li :class "foo"
(<:ah c)))
@jasom
Copy link

jasom commented Apr 4, 2013

(defun who-list-item (c s)
  (cl-who:with-html-output  (s)
    (:li (cl-who:esc c))))

(let ((colors '("red" "green" "blue")))
  (who:with-html-output-to-string (s)
    (:html
     (:head
      (:title "Colors"))
     (:body
      (:ul
       (dolist (c colors)
         (who-list-item c s)))))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment