File tree Expand file tree Collapse file tree 1 file changed +8
-15
lines changed
crates/djls-template-ast/src Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -155,26 +155,19 @@ impl Parser {
155155
156156 let specs = TagSpec :: load_builtin_specs ( ) . unwrap_or_default ( ) ;
157157
158- // Check if this is a closing tag
158+ // Check if this is a closing or branch tag
159159 for ( _, spec) in specs. iter ( ) {
160- if Some ( & tag_name) == spec. closing . as_ref ( ) {
161- // let node = Node::Django(DjangoNode::Tag(TagNode::Closing {
162- // name: tag_name.clone(),
163- // bits: bits[1..].to_vec(),
164- // }));
160+ if Some ( & tag_name) == spec. closing . as_ref ( )
161+ || spec
162+ . branches
163+ . as_ref ( )
164+ . map ( |ints| ints. iter ( ) . any ( |i| i. name == tag_name) )
165+ . unwrap_or ( false )
166+ {
165167 return Err ( ParserError :: ErrorSignal ( Signal :: SpecialTag ( tag_name) ) ) ;
166168 }
167169 }
168170
169- // Check if this is a branch tag according to any spec
170- for ( _, spec) in specs. iter ( ) {
171- if let Some ( branches) = & spec. branches {
172- if branches. iter ( ) . any ( |i| i. name == tag_name) {
173- return Err ( ParserError :: ErrorSignal ( Signal :: SpecialTag ( tag_name) ) ) ;
174- }
175- }
176- }
177-
178171 let tag_spec = specs. get ( tag_name. as_str ( ) ) . cloned ( ) ;
179172 let mut children = Vec :: new ( ) ;
180173 let mut current_branch: Option < ( String , Vec < String > , Vec < Node > ) > = None ;
You can’t perform that action at this time.
0 commit comments