;;;; crazystring.lisp -- Turn a string into funky HTML. ;;;; Copyright 2003 Rob Warnock -- All Rights Reserved. ;;;; ;;;; Excerpted from . ;;;; Uses the WITH-HTML-OUTPUT macro from Tim Bradshaw's HTOUT ;;;; package: ;;; Example: (crazy-string t "hello") prints: ;;; h ;;; e ;;; l ;;; l ;;; o (defconstant +crazy-string-defaults+ '#1=(("#0000FF" nil "6") ("#FF0000" sub "6") ("#00FF00" sup "6") ("#c08000" nil "6") ("#0000FF" sub "6") ("#FF0000" sup "6") ("#00FF00" nil "6") ("#c08000" sup "6") . #1#)) ; and so on, forever... (defun crazy-string (stream string &optional (attrs +crazy-string-defaults+)) (with-html-output (s stream t) (loop for c across string and (color pos size) in attrs do (case pos ((sub) (htm (:sub () (:font (:color color :size size) c)))) ((sup) (htm (:sup () (:font (:color color :size size) c)))) (t (htm (:font (:color color :size size) c)))) (lfd))))