Add with-list-group* alternative

This commit is contained in:
Marcus Kammer 2025-01-23 13:50:32 +01:00
parent e2936d013c
commit ed1987691b
Signed by: marcuskammer
GPG key ID: C374817BE285268F

View file

@ -22,7 +22,8 @@
(:export
#:item
#:list-group
#:with-list-group)
#:with-list-group
#:with-list-group*)
(:documentation "A Common Lisp package for generating Bootstrap List Group components."))
(in-package :ml-sbt/list-group)
@ -85,5 +86,13 @@ ITEMS: A list of items to be included in the list group."
;; 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))))))))
`((dolist (item ,items)
(:li :class "list-group-item" item))))))))
(defmacro with-list-group* (flush items)
(let ((class-str (format nil "list-group~@[ list-group-flush~]" flush)))
`(spinneret:with-html
(:ul :class ,class-str
,@(progn
`((dolist (item ,items)
(:li :class "list-group-item" item))))))))