From: ········@yahoo.es
Subject: a simple htm creator (newbie)
Date:
Message-ID: <31cc10b4-938f-4c08-beeb-cc17a182ef81@s13g2000prd.googlegroups.com>
;; just for fun
(defparameter *tags* '(html head title body form table tr td a img h1
h2 h3 h4 h5 h6 h7))
(defun lector(l) (mapc #'lee l) *s*)
(defun lee(x)
(cond ( (listp x) (if (member (car x) *tags*) (f x) (g x)))
(t (with-output-to-string (s *s*)
(format s "~A " x)))))
(defun f(x)
(with-output-to-string (s *s*)
(format s "<~A>" (car x)) (lector (cdr x)) (format s "</~A>" (car
x))))
(defun g(x)
(lector (list (eval x))))
(defun to-htm(x)
(setq *s* (make-array '(100) :element-type 'base-char :adjustable
t :fill-pointer 0))
(lector x))
(defun row (&rest l) (cons 'tr (mapcar (lambda(x) (list 'td x)) l)))
;; An example:
(to-htm
'((html
(head (title Hello) )
(body (h1 Hello) <br> My name is Lucas
(table (row 1 2 3) (row 4 5 6))))))