(let ((tag (if *downcase-tokens-p* (string-downcase tag) (string tag)))
(body-indent
;; increase *INDENT* by 2 for body -- or disable it
- (when (and *indent* (not (member tag *html-no-indent-tags* :test #'string-equal)))
+ (when (and *indent* (not (member tag *html-no-indent-tags*
+ :test #'string-equal)))
(+ 2 *indent*))))
(nconc
(if *indent*
(defun tree-to-template (tree)
"Transforms an HTML tree into an intermediate format - mainly a
-flattened list of strings. Utility function used by TREE-TO-COMMANDS-AUX."
+flattened list of strings. Utility function used by TREE-TO-COMMANDS."
(loop for element in tree
if (or (keywordp element)
(and (listp element)
"Concatenates all arguments which should be string into one string."
(funcall #'string-list-to-string string-list))
-(defun tree-to-commands (tree stream &key prologue ((:indent *indent*) *indent*))
+(defun tree-to-commands (tree stream
+ &key prologue ((:indent *indent*) *indent*))
(declare (optimize speed space))
(when (and *indent*
(not (integerp *indent*)))
,@declarations
(check-type ,var stream)
(macrolet ((htm (&body body)
- `(with-html-output (,',var nil :prologue nil :indent ,,indent)
+ `(with-html-output (,',var nil
+ :prologue nil
+ :indent ,,indent)
,@body))
(fmt (&rest args)
`(format ,',var ,@args))
(esc (thing)
(with-unique-names (result)
`(let ((,result ,thing))
- (when ,result (write-string (escape-string ,result) ,',var)))))
+ (when ,result
+ (write-string (escape-string ,result) ,',var)))))
(str (thing)
(with-unique-names (result)
`(let ((,result ,thing))
(defmacro with-html-output-to-string ((var &optional string-form
&key #-(or :ecl :cmu :sbcl)
- (element-type #-:lispworks ''character
- #+:lispworks ''lw:simple-char)
- prologue
- indent)
+ (element-type
+ #-:lispworks ''character
+ #+:lispworks ''lw:simple-char)
+ prologue
+ indent)
&body body)
"Transform the enclosed BODY consisting of HTML as s-expressions
into Lisp code which creates the corresponding HTML as a string."