Move EndBlock to own element
Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
parent
08b480705b
commit
383f543119
4 changed files with 38 additions and 43 deletions
|
|
@ -229,7 +229,6 @@ pub enum TemplateAstExpr<'input> {
|
|||
IfConditional {
|
||||
if_block: Box<TemplateAstExpr<'input>>,
|
||||
content: Vec<TemplateAstExpr<'input>>,
|
||||
end_block: Box<TemplateAstExpr<'input>>,
|
||||
},
|
||||
ElseConditional {
|
||||
expression: Vec<TemplateAstExpr<'input>>,
|
||||
|
|
@ -319,13 +318,10 @@ fn parse_conditional_chain<'input>(
|
|||
let mut chain = vec![];
|
||||
|
||||
let (content, end_block): (Vec<_>, _) =
|
||||
repeat_till(0.., parse_ast, parse_end.map(Box::new)).parse_next(input)?;
|
||||
repeat_till(0.., parse_ast, parse_end).parse_next(input)?;
|
||||
|
||||
chain.push(TemplateAstExpr::IfConditional {
|
||||
if_block,
|
||||
content,
|
||||
end_block,
|
||||
});
|
||||
chain.push(TemplateAstExpr::IfConditional { if_block, content });
|
||||
chain.push(end_block);
|
||||
|
||||
Ok(TemplateAstExpr::ConditionalChain { chain })
|
||||
})
|
||||
|
|
@ -519,13 +515,13 @@ mod tests {
|
|||
[Content]"Hiii" (13..17),
|
||||
),
|
||||
],
|
||||
end_block: Block {
|
||||
prev_whitespace_content: Some(
|
||||
[Whitespace]" " (17..18),
|
||||
),
|
||||
expression: EndBlock,
|
||||
post_whitespace_content: None,
|
||||
},
|
||||
},
|
||||
Block {
|
||||
prev_whitespace_content: Some(
|
||||
[Whitespace]" " (17..18),
|
||||
),
|
||||
expression: EndBlock,
|
||||
post_whitespace_content: None,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue