Skip to content

Commit

Permalink
fix(utils/yaml): Remove jinja2 block delimiters from YAML (renovatebo…
Browse files Browse the repository at this point in the history
  • Loading branch information
onedr0p authored and zT-1337 committed Jan 24, 2024
1 parent ac41910 commit c96df4f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/util/yaml.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,19 @@ describe('util/yaml', () => {
codeBlock`
myObject:
aString: {{value}}
{% if test.enabled %}
myNestedObject:
aNestedString: {{value}}
{% endif %}
`,
{ removeTemplates: true },
),
).toEqual({
myObject: {
aString: null,
myNestedObject: {
aNestedString: null,
},
},
});
});
Expand Down
4 changes: 3 additions & 1 deletion lib/util/yaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ function massageContent(content: string, options?: YamlOptions): string {
if (options?.removeTemplates) {
return content
.replace(regEx(/{{`.+?`}}/gs), '')
.replace(regEx(/{{.+?}}/g), '');
.replace(regEx(/{{.+?}}/g), '')
.replace(regEx(/{%`.+?`%}/gs), '')
.replace(regEx(/{%.+?%}/g), '');
}

return content;
Expand Down

0 comments on commit c96df4f

Please sign in to comment.