Fix props->string function
This commit is contained in:
parent
e4c0e0f597
commit
1acb065464
1 changed files with 19 additions and 12 deletions
|
@ -72,14 +72,16 @@
|
||||||
(children element-children)) elm
|
(children element-children)) elm
|
||||||
(let ((type-str (string-downcase type)))
|
(let ((type-str (string-downcase type)))
|
||||||
(if children
|
(if children
|
||||||
(format stream (if (rest children)
|
(format stream
|
||||||
"~@<<~a~a>~2I~:@_~<~@{~a~^~:@_~}~:>~0I~:@_</~a>~:>"
|
(if (rest children)
|
||||||
"~@<<~a~a>~2I~:_~<~a~^~:@_~:>~0I~_</~a>~:>")
|
"~@<<~a~a>~2I~:@_~<~@{~a~^~:@_~}~:>~0I~:@_</~a>~:>"
|
||||||
|
"~@<<~a~a>~2I~:_~<~a~^~:@_~:>~0I~_</~a>~:>")
|
||||||
type-str
|
type-str
|
||||||
(props->string props)
|
(props->string props)
|
||||||
children
|
children
|
||||||
type-str)
|
type-str)
|
||||||
(format stream "<~a~a></~a>"
|
(format stream
|
||||||
|
"<~a~a></~a>"
|
||||||
type-str
|
type-str
|
||||||
(props->string props)
|
(props->string props)
|
||||||
type-str)))))
|
type-str)))))
|
||||||
|
@ -88,11 +90,15 @@
|
||||||
(with-output-to-string (stream)
|
(with-output-to-string (stream)
|
||||||
(loop
|
(loop
|
||||||
:for (key value) :on props :by #'cddr
|
:for (key value) :on props :by #'cddr
|
||||||
:do (format stream (if (typep value 'boolean)
|
:do (let ((key-str (string-downcase key)))
|
||||||
"~@[ ~a~]"
|
(if (typep value 'boolean)
|
||||||
" ~a=\"~a\"")
|
(format stream
|
||||||
(string-downcase key)
|
"~@[ ~a~]"
|
||||||
value))))
|
(and value key-str))
|
||||||
|
(format stream
|
||||||
|
" ~a=\"~a\""
|
||||||
|
key-str
|
||||||
|
value))))))
|
||||||
|
|
||||||
(defmethod print-object ((elm html-tag) stream)
|
(defmethod print-object ((elm html-tag) stream)
|
||||||
(format stream "<!DOCTYPE html>~%")
|
(format stream "<!DOCTYPE html>~%")
|
||||||
|
@ -101,9 +107,10 @@
|
||||||
(defmethod print-object ((elm fragment) stream)
|
(defmethod print-object ((elm fragment) stream)
|
||||||
(with-accessors ((children element-children)) elm
|
(with-accessors ((children element-children)) elm
|
||||||
(if children
|
(if children
|
||||||
(format stream (if (rest children)
|
(format stream
|
||||||
"~<~@{~a~^~:@_~}~:>"
|
(if (rest children)
|
||||||
"~<~a~:>")
|
"~<~@{~a~^~:@_~}~:>"
|
||||||
|
"~<~a~:>")
|
||||||
children))))
|
children))))
|
||||||
|
|
||||||
(defmethod print-object ((elm component) stream)
|
(defmethod print-object ((elm component) stream)
|
||||||
|
|
Loading…
Reference in a new issue