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"
|
||||
(:h5 :class "card-header" ,header)
|
||||
,@(when items
|
||||
`((with-list-group ,items t)))
|
||||
`((with-list-group t ,items)))
|
||||
(:div :class "card-body"
|
||||
,@body)))))
|
||||
|
||||
|
@ -208,6 +208,6 @@ Example:
|
|||
,@(if card-header
|
||||
`((:h5 :class "card-header" ,card-header)))
|
||||
,@(if card-items
|
||||
`((with-list-group ,card-items t)))
|
||||
`((with-list-group t ,card-items)))
|
||||
(:div :class "card-body"
|
||||
,card-body)))))))
|
||||
|
|
|
@ -59,31 +59,31 @@ Example:
|
|||
(defun list-group (flush &rest items)
|
||||
"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)))
|
||||
(spinneret:with-html
|
||||
(:ul :class class-str
|
||||
(loop for item in items
|
||||
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.
|
||||
|
||||
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."
|
||||
(let ((class-str (if flush "list-group list-group-flush" "list-group")))
|
||||
ITEMS: A list of items to be included in the list group."
|
||||
(let ((class-str (format nil "list-group~@[ list-group-flush~]" flush)))
|
||||
`(spinneret:with-html
|
||||
(:ul :class ,class-str
|
||||
,@(if (and (listp items) (eq (car items) 'quote))
|
||||
;; If items is a quoted list, use it directly
|
||||
(loop for item in (cadr items)
|
||||
collect `(:li :class "list-group-item" ,item))
|
||||
(loop :for item :in (cadr items)
|
||||
:collect `(:li :class "list-group-item" ,item))
|
||||
;; 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. :(
|
||||
;; If you are able to understand it, and able to explain it to me, please send me an email:
|
||||
;; marcus.kammer@mailbox.org
|
||||
`((loop for item in ,items
|
||||
do (:li :class "list-group-item" item))))))))
|
||||
`((loop :for item :in ,items
|
||||
:do (:li :class "list-group-item" item))))))))
|
||||
|
|
Loading…
Add table
Reference in a new issue