+ (post-process-html-forms
+ (process-html-forms forms env)))
+
+(defun post-process-html-forms (input-forms)
+ "KMR: Walk through forms and combine write-strings"
+ (let (res strs last-stream)
+ (flet ((flush-strings ()
+ (when strs
+ (push `(write-string ,strs ,last-stream) res)
+ (setq strs nil)
+ (setq last-stream nil))))
+ (do* ((forms input-forms (cdr forms))
+ (form (car forms) (car forms)))
+ ((null forms)
+ (flush-strings)
+ (nreverse res))
+ (cond
+ ((atom form)
+ (flush-strings)
+ (push form res))
+ ((and (eq (car form) 'cl:write-string)
+ (stringp (cadr form)))
+ (if strs
+ (if (eq last-stream (third form))
+ (setq strs (concatenate 'string strs (second form)))
+ (progn
+ (flush-strings)
+ (setq strs (second form))
+ (setq last-stream (third form))))
+ (progn
+ (setq strs (second form))
+ (setq last-stream (third form)))))
+ (t
+ (flush-strings)
+ (push (post-process-html-forms form) res)))))))
+