Skip to content

Commit f391e0d

Browse files
revert
1 parent 43b5c78 commit f391e0d

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

crates/djls-template-ast/src/parser.rs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)