(in-package :parenscript)
+(defvar *self-closing-tags-p* t)
+
(defun concat-constant-strings (str-list)
(reverse (reduce (lambda (optimized-list next-obj)
(if (and (or (numberp next-obj) (stringp next-obj)) (stringp (car optimized-list)))
(push (format nil " ~A=\"" attr-name) r)
(push attr-val r)
(push "\"" r))))
- (push ">" r)
- (map nil #'process-form (cdr form))
- (push (format nil "</~A>" (caar form)) r))
+ (if (or (cdr form) (not *self-closing-tags-p*))
+ (progn (push ">" r)
+ (map nil #'process-form (cdr form))
+ (push (format nil "</~A>" (caar form)) r))
+ (push "/>" r)))
(t (push form r)))))
(map nil #'process-form forms)
(concat-constant-strings (reverse r)))))
(push "\"" r)
(process-attributes (cddr attrs))))))
(process-attributes (cdr form))
- (push ">" r)
- (when content
- (map nil #'process-form content))))
- (push (format nil "</~A>" (car form)) r))
+ (if (or content (not *self-closing-tags-p*))
+ (progn (push ">" r)
+ (when content (map nil #'process-form content))
+ (push (format nil "</~A>" (car form)) r))
+ (push "/>" r)))))
(t (push form r)))))
(map nil #'process-form forms)
(concat-constant-strings (reverse r)))))