Add multiline support for with expression

Improve templating support for block rendering for `with` expression
that has multiline code. This improves templating support to render
multiline code conditionally.

This did not work before but works now:

```
{{ with $middleLine }}
  first line
  second line
{{ end }}
```
This commit is contained in:
undergroundwires
2022-10-02 20:12:49 +02:00
parent 7d3670c26d
commit e8d06e0f3e
6 changed files with 136 additions and 31 deletions

View File

@@ -23,6 +23,14 @@ export class SyntaxParserTestsRunner {
return this;
}
public expectNoMatch(...testCases: INoMatchTestCase[]) {
this.expectPosition(...testCases.map((testCase) => ({
name: testCase.name,
code: testCase.code,
expected: [],
})));
}
public expectResults(...testCases: IExpectResultTestCase[]) {
for (const testCase of testCases) {
it(testCase.name, () => {
@@ -104,6 +112,11 @@ interface IExpectPositionTestCase {
expected: readonly ExpressionPosition[];
}
interface INoMatchTestCase {
name: string;
code: string;
}
interface IExpectPipeHitTestData {
codeBuilder: (pipeline: string) => string;
parameterName: string;