File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,7 @@ public struct Grid: HTML, HorizontalAligning {
149149 } else {
150150 handleItem ( item)
151151 . class ( gutterClass)
152+ . render ( )
152153 }
153154 }
154155 }
@@ -157,15 +158,17 @@ public struct Grid: HTML, HorizontalAligning {
157158 }
158159
159160 /// Removes a column class, if it exists, from the item and reassigns it to a wrapper.
160- private func handleItem( _ item: any HTML ) -> some HTML {
161+ private func handleItem( _ item: any HTML ) -> any HTML {
161162 var item = item
162163 var name : String ?
163164 if let widthClass = item. attributes. classes. first ( where: { $0. starts ( with: " col-md- " ) } ) {
164165 item. attributes. remove ( classes: widthClass)
165166 name = scaleWidthClass ( widthClass)
166167 }
167168
168- return Section ( item)
169+ item = item. isSection ? item : Section ( item)
170+
171+ return item
169172 . class ( name ?? " col " )
170173 . class ( alignment. vertical. itemAlignmentClass)
171174 }
@@ -185,6 +188,7 @@ public struct Grid: HTML, HorizontalAligning {
185188 return ForEach ( passthrough. items) { item in
186189 handleItem ( item. attributes ( attributes) )
187190 . class ( gutterClass)
191+ . render ( )
188192 }
189193 }
190194
Original file line number Diff line number Diff line change @@ -89,6 +89,11 @@ extension HTML {
8989 var isImage : Bool {
9090 self is Image || ( self as? AnyHTML ) ? . wrapped is Image
9191 }
92+
93+ /// A Boolean value indicating whether this represents `Section`.
94+ var isSection : Bool {
95+ self is Section || ( self as? AnyHTML ) ? . wrapped is Section
96+ }
9297}
9398
9499extension HTML {
You can’t perform that action at this time.
0 commit comments