Re-order arguments in with-list-group
This commit is contained in:
parent
e79ca43a58
commit
e2936d013c
2 changed files with 12 additions and 12 deletions
|
@ -182,7 +182,7 @@ Example:
|
||||||
(:div :class "card h-100"
|
(:div :class "card h-100"
|
||||||
(:h5 :class "card-header" ,header)
|
(:h5 :class "card-header" ,header)
|
||||||
,@(when items
|
,@(when items
|
||||||
`((with-list-group ,items t)))
|
`((with-list-group t ,items)))
|
||||||
(:div :class "card-body"
|
(:div :class "card-body"
|
||||||
,@body)))))
|
,@body)))))
|
||||||
|
|
||||||
|
@ -208,6 +208,6 @@ Example:
|
||||||
,@(if card-header
|
,@(if card-header
|
||||||
`((:h5 :class "card-header" ,card-header)))
|
`((:h5 :class "card-header" ,card-header)))
|
||||||
,@(if card-items
|
,@(if card-items
|
||||||
`((with-list-group ,card-items t)))
|
`((with-list-group t ,card-items)))
|
||||||
(:div :class "card-body"
|
(:div :class "card-body"
|
||||||
,card-body)))))))
|
,card-body)))))))
|
||||||
|
|
|
@ -59,31 +59,31 @@ Example:
|
||||||
(defun list-group (flush &rest items)
|
(defun list-group (flush &rest items)
|
||||||
"This macro generates a Bootstrap list group.
|
"This macro generates a Bootstrap list group.
|
||||||
|
|
||||||
ITEMS: A list of items to be included in the list group.
|
FLUSH: If true, adds the 'list-group-flush' class.
|
||||||
|
|
||||||
FLUSH: If true, adds the 'list-group-flush' class."
|
ITEMS: A list of items to be included in the list group."
|
||||||
(let ((class-str (format nil "list-group~@[ list-group-flush~]" flush)))
|
(let ((class-str (format nil "list-group~@[ list-group-flush~]" flush)))
|
||||||
(spinneret:with-html
|
(spinneret:with-html
|
||||||
(:ul :class class-str
|
(:ul :class class-str
|
||||||
(loop for item in items
|
(loop for item in items
|
||||||
do (:li :class "list-group-item" item))))))
|
do (:li :class "list-group-item" item))))))
|
||||||
|
|
||||||
(defmacro with-list-group (items &optional flush)
|
(defmacro with-list-group (flush items)
|
||||||
"This macro generates a Bootstrap list group.
|
"This macro generates a Bootstrap list group.
|
||||||
|
|
||||||
ITEMS: A list of items to be included in the list group.
|
FLUSH: If true, adds the 'list-group-flush' class.
|
||||||
|
|
||||||
FLUSH: If true, adds the 'list-group-flush' class."
|
ITEMS: A list of items to be included in the list group."
|
||||||
(let ((class-str (if flush "list-group list-group-flush" "list-group")))
|
(let ((class-str (format nil "list-group~@[ list-group-flush~]" flush)))
|
||||||
`(spinneret:with-html
|
`(spinneret:with-html
|
||||||
(:ul :class ,class-str
|
(:ul :class ,class-str
|
||||||
,@(if (and (listp items) (eq (car items) 'quote))
|
,@(if (and (listp items) (eq (car items) 'quote))
|
||||||
;; If items is a quoted list, use it directly
|
;; If items is a quoted list, use it directly
|
||||||
(loop for item in (cadr items)
|
(loop :for item :in (cadr items)
|
||||||
collect `(:li :class "list-group-item" ,item))
|
:collect `(:li :class "list-group-item" ,item))
|
||||||
;; Otherwise, assume it's a variable and generate code to be evaluated at runtime
|
;; Otherwise, assume it's a variable and generate code to be evaluated at runtime
|
||||||
;; FUCK YOU COMMON LISP! I really don't understand how this works. :(
|
;; FUCK YOU COMMON LISP! I really don't understand how this works. :(
|
||||||
;; If you are able to understand it, and able to explain it to me, please send me an email:
|
;; If you are able to understand it, and able to explain it to me, please send me an email:
|
||||||
;; marcus.kammer@mailbox.org
|
;; marcus.kammer@mailbox.org
|
||||||
`((loop for item in ,items
|
`((loop :for item :in ,items
|
||||||
do (:li :class "list-group-item" item))))))))
|
:do (:li :class "list-group-item" item))))))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue