From ac4080140c9c151f88729c59d608b2c6a5adbabc Mon Sep 17 00:00:00 2001 From: Daniel Gackle Date: Sun, 20 Jun 2010 19:30:21 -0600 Subject: [PATCH] Extended the amount of compile-time string concatentation PS can do when emitting HTML. --- src/lib/ps-html.lisp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/lib/ps-html.lisp b/src/lib/ps-html.lisp index c690b34..261f7c1 100644 --- a/src/lib/ps-html.lisp +++ b/src/lib/ps-html.lisp @@ -12,11 +12,20 @@ (member tag *html-empty-tags*))) (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))) - (cons (format nil "~a~a" (car optimized-list) next-obj) (cdr optimized-list)) - (cons next-obj optimized-list))) - (cons () str-list)))) + (flet ((expand (expr) + (setf expr (ps-macroexpand expr)) + (cond ((and (consp expr) (eq (car expr) 'quote) (symbolp (second expr))) + (symbol-to-js-string (second expr))) + ((keywordp expr) (string-downcase expr)) + ((characterp expr) (string expr)) + (t expr)))) + (reverse (reduce (lambda (optimized-list next-expr) + (let ((next-obj (expand next-expr))) + (if (and (or (numberp next-obj) (stringp next-obj)) + (stringp (car optimized-list))) + (cons (format nil "~a~a" (car optimized-list) next-obj) (cdr optimized-list)) + (cons next-obj optimized-list)))) + (cons () str-list))))) (defun process-html-forms-lhtml (forms) (let ((r ())) -- 2.11.4.GIT