Skip to content
Snippets Groups Projects
Unverified Commit 36604f14 authored by Devin Buhl's avatar Devin Buhl Committed by GitHub
Browse files

fix(utils/yaml): Remove jinja2 block delimiters from YAML (#26682)

parent 5440aab7
No related branches found
No related tags found
No related merge requests found
...@@ -102,12 +102,19 @@ describe('util/yaml', () => { ...@@ -102,12 +102,19 @@ describe('util/yaml', () => {
codeBlock` codeBlock`
myObject: myObject:
aString: {{value}} aString: {{value}}
{% if test.enabled %}
myNestedObject:
aNestedString: {{value}}
{% endif %}
`, `,
{ removeTemplates: true }, { removeTemplates: true },
), ),
).toEqual({ ).toEqual({
myObject: { myObject: {
aString: null, aString: null,
myNestedObject: {
aNestedString: null,
},
}, },
}); });
}); });
......
...@@ -37,7 +37,9 @@ function massageContent(content: string, options?: YamlOptions): string { ...@@ -37,7 +37,9 @@ function massageContent(content: string, options?: YamlOptions): string {
if (options?.removeTemplates) { if (options?.removeTemplates) {
return content return content
.replace(regEx(/{{`.+?`}}/gs), '') .replace(regEx(/{{`.+?`}}/gs), '')
.replace(regEx(/{{.+?}}/g), ''); .replace(regEx(/{{.+?}}/g), '')
.replace(regEx(/{%`.+?`%}/gs), '')
.replace(regEx(/{%.+?%}/g), '');
} }
return content; return content;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment