@@ -31,14 +31,17 @@ def do_bird(parser: Parser, token: Token) -> BirdNode:
3131 name = bits [1 ].strip ("'\" " )
3232 attrs = bits [2 :]
3333
34- nodelist = parser .parse (("endbird" ,))
35- parser .delete_first_token ()
34+ if len (attrs ) > 0 and attrs [- 1 ] == "/" :
35+ nodelist = None
36+ else :
37+ nodelist = parser .parse (("endbird" ,))
38+ parser .delete_first_token ()
3639
3740 return BirdNode (name , attrs , nodelist )
3841
3942
4043class BirdNode (template .Node ):
41- def __init__ (self , name : str , attrs : list [str ], nodelist : NodeList ) -> None :
44+ def __init__ (self , name : str , attrs : list [str ], nodelist : NodeList | None ) -> None :
4245 self .name = name
4346 self .attrs = attrs
4447 self .nodelist = nodelist
@@ -61,6 +64,9 @@ def render(self, context: Context) -> SafeString:
6164 return render_to_string (f"bird/{ self .name } .html" , component_context )
6265
6366 def render_slots (self , context : Context ) -> dict [str , str ]:
67+ if self .nodelist is None :
68+ return {}
69+
6470 contents : dict [str , list [str ]] = {self .default_slot : []}
6571 active_slot = self .default_slot
6672
0 commit comments