Apply render-children to fragment
This commit is contained in:
parent
f770e371b9
commit
d203c703c4
1 changed files with 16 additions and 16 deletions
|
@ -96,6 +96,22 @@
|
|||
(with-slots (type props) element
|
||||
(format stream "<~a~a>" (string-downcase type) (render-props props))))
|
||||
|
||||
(defmethod print-object ((element html-tag) stream)
|
||||
(format stream "<!DOCTYPE html>~%")
|
||||
(call-next-method))
|
||||
|
||||
(defmethod print-object ((element fragment) stream)
|
||||
(with-slots (children) element
|
||||
(if children
|
||||
(format stream
|
||||
(if (rest children)
|
||||
"~<~@{~a~^~:@_~}~:>"
|
||||
"~<~a~:>")
|
||||
(render-children element)))))
|
||||
|
||||
(defmethod print-object ((element component) stream)
|
||||
(print-object (expand-component element) stream))
|
||||
|
||||
(defun render-props (props)
|
||||
(with-output-to-string (stream)
|
||||
(loop
|
||||
|
@ -120,22 +136,6 @@
|
|||
(defmethod render-children ((element non-escaping-tag))
|
||||
(element-children element))
|
||||
|
||||
(defmethod print-object ((element html-tag) stream)
|
||||
(format stream "<!DOCTYPE html>~%")
|
||||
(call-next-method))
|
||||
|
||||
(defmethod print-object ((element fragment) stream)
|
||||
(with-slots (children) element
|
||||
(if children
|
||||
(format stream
|
||||
(if (rest children)
|
||||
"~<~@{~a~^~:@_~}~:>"
|
||||
"~<~a~:>")
|
||||
children))))
|
||||
|
||||
(defmethod print-object ((element component) stream)
|
||||
(print-object (expand-component element) stream))
|
||||
|
||||
(defmethod expand-component ((element component))
|
||||
(with-slots (type props children) element
|
||||
(apply type (merge-children-into-props props children))))
|
||||
|
|
Loading…
Reference in a new issue