mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-06 02:30:42 -08:00
Introduce a new low level creation for clog element: 'create-element' #286
This commit is contained in:
parent
f5420f9f24
commit
4d69a28aa8
3 changed files with 29 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -18,3 +18,4 @@
|
||||||
*.wx32fsl
|
*.wx32fsl
|
||||||
*~
|
*~
|
||||||
*.bak
|
*.bak
|
||||||
|
*.64yfasl
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,33 @@ CONNECTION-ID to it and then return it. The HTML-ID must be unique. (private)"
|
||||||
;; Low Level - clog-element
|
;; Low Level - clog-element
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
;; create-element ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
(defgeneric create-element (clog-obj html-tag &rest all-args &key content clog-type html-id
|
||||||
|
auto-place &allow-other-keys )
|
||||||
|
(:documentation "Create a new CLOG-element as child of CLOG-OBJ with any possible keywords.")
|
||||||
|
(:method (clog-obj html-tag &rest all-args &key (content "")
|
||||||
|
clog-type
|
||||||
|
(html-id (clog-connection:generate-id))
|
||||||
|
(auto-place t)
|
||||||
|
&allow-other-keys )
|
||||||
|
(let* ((extra-args (alexandria:remove-from-plist all-args :content :clog-type :html-id :auto-place))
|
||||||
|
(html (with-output-to-string (*standard-output*)
|
||||||
|
(format t "<~(~a~) " html-tag)
|
||||||
|
(loop for (key value) on extra-args by #'cddr
|
||||||
|
do (format t "~(~a~)=~s" key value))
|
||||||
|
(format t " id=~s>~A</~(~a~)>" html-id content html-tag)))
|
||||||
|
(clog-type (or clog-type
|
||||||
|
(let* ((class-name (intern (string-upcase (format nil "CLOG-~a" html-tag)) :clog)))
|
||||||
|
(when (find-class class-name nil)
|
||||||
|
class-name))
|
||||||
|
'clog-element)))
|
||||||
|
(create-child clog-obj html
|
||||||
|
:clog-type clog-type
|
||||||
|
:html-id html-id
|
||||||
|
:auto-place auto-place))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;
|
||||||
;; create-child ;;
|
;; create-child ;;
|
||||||
;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
||||||
|
|
@ -201,6 +201,7 @@ embedded in a native template application.)"
|
||||||
(clog-element class)
|
(clog-element class)
|
||||||
|
|
||||||
"CLOG-Element - Low Level Creation"
|
"CLOG-Element - Low Level Creation"
|
||||||
|
(create-element generic-function)
|
||||||
(create-child generic-function)
|
(create-child generic-function)
|
||||||
(attach-as-child generic-function)
|
(attach-as-child generic-function)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue