Skip to content

Commit

Permalink
Merge bd56230 into 83a4fbb
Browse files Browse the repository at this point in the history
  • Loading branch information
andradf committed Feb 1, 2023
2 parents 83a4fbb + bd56230 commit 66f9a0d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Scriban.Tests/TestParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,20 @@ public void TestIndent2()
TextAssert.AreEqual(" test\n test2", result);
}

[Test]
public void TestIndent3()
{
var input = @"a
{{~ if true ~}}
b
{{~ end ~}}
{{'c'}}";
var template = Template.Parse(input);
var result = template.Render();
result = TextAssert.Normalize(result);

TextAssert.AreEqual("a\nb\n c", result);
}

[TestCaseSource("ListTestFiles", new object[] { "000-basic" })]
public static void A000_basic(string inputName)
Expand Down
3 changes: 3 additions & 0 deletions src/Scriban/TemplateContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,9 @@ public TemplateContext Write(string text, int startIndex, int count)
}
else
{
if(count > 0){
_previousTextWasNewLine = text[startIndex + count - 1] == '\n';
}
Output.Write(text, startIndex, count);
}
}
Expand Down

0 comments on commit 66f9a0d

Please sign in to comment.