Skip to content

Commit 32bc309

Browse files
committed
fix: disable partial indent with leading ~
1 parent ac5bd3c commit 32bc309

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/partial.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,23 @@ outer third line"#,
595595
.unwrap()
596596
);
597597

598+
hb.register_template_string(
599+
"t4",
600+
r#"{{#*inline "thepartial"}}
601+
inner first line
602+
inner second line
603+
{{/inline}}
604+
{{~> thepartial}}
605+
outer third line"#,
606+
)
607+
.unwrap();
608+
assert_eq!(
609+
r#" inner first line
610+
inner second line
611+
outer third line"#,
612+
hb.render("t4", &()).unwrap()
613+
);
614+
598615
let mut hb2 = Registry::new();
599616
hb2.set_prevent_indent(true);
600617

src/template.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,10 @@ impl Template {
728728

729729
// indent for partial expression >
730730
let mut indent = None;
731-
if rule == Rule::partial_expression && !options.prevent_indent {
731+
if rule == Rule::partial_expression
732+
&& !options.prevent_indent
733+
&& !exp.omit_pre_ws
734+
{
732735
indent = support::str::find_trailing_whitespace_chars(
733736
&source[..span.start()],
734737
);

0 commit comments

Comments
 (0)