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
|
(with-slots (type props) element
|
||||||
(format stream "<~a~a>" (string-downcase type) (render-props props))))
|
(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)
|
(defun render-props (props)
|
||||||
(with-output-to-string (stream)
|
(with-output-to-string (stream)
|
||||||
(loop
|
(loop
|
||||||
|
@ -120,22 +136,6 @@
|
||||||
(defmethod render-children ((element non-escaping-tag))
|
(defmethod render-children ((element non-escaping-tag))
|
||||||
(element-children element))
|
(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))
|
(defmethod expand-component ((element component))
|
||||||
(with-slots (type props children) element
|
(with-slots (type props children) element
|
||||||
(apply type (merge-children-into-props props children))))
|
(apply type (merge-children-into-props props children))))
|
||||||
|
|
Loading…
Reference in a new issue