Patch in content of previous block if it exists

Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
Marcel Müller 2026-03-09 13:08:15 +01:00
parent ae379df9db
commit 6a233e978f
6 changed files with 34 additions and 29 deletions

View file

@ -122,9 +122,14 @@ fn emit_ast_expr(
{
previous_post_whitespace_content = post_whitespace_content;
if let Some(ws) = prev_whitespace_content {
eval.push(Instruction::AppendContent {
content: ws.source().clone(),
});
eval.insert(
eval.len() - 2,
Instruction::AppendContent {
content: ws.source().clone(),
},
);
let index_index = end_indices.len() - 1;
end_indices[index_index] += 1;
}
if let TemplateAstExpr::IfConditional { expression } = &**expression {

View file

@ -21,15 +21,15 @@ expression: emit
AppendContent {
content: "foo" (13..16),
},
AppendContent {
content: " " (16..17),
},
Jump {
jump: 14,
jump: 13,
},
AppendContent {
content: " " (12..13),
},
AppendContent {
content: " " (16..17),
},
LoadFromContextToSlot {
name: "bar" (28..31),
slot: VariableSlot {
@ -48,28 +48,28 @@ expression: emit
AppendContent {
content: "bar" (35..38),
},
AppendContent {
content: " " (38..39),
},
Jump {
jump: 7,
jump: 6,
},
AppendContent {
content: " " (34..35),
},
AppendContent {
content: " " (38..39),
},
AppendContent {
content: " " (49..50),
},
AppendContent {
content: "foobar" (50..56),
},
AppendContent {
content: " " (56..57),
},
Jump {
jump: 2,
jump: 1,
},
AppendContent {
content: " " (49..50),
},
AppendContent {
content: " " (56..57),
},
]