bug: should check the children of the first parse, not the root.
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -114,9 +114,10 @@ export class NunjucksWorkflowRunner implements WorkflowRunner {
|
||||
private isSingleTemplateString(input: string) {
|
||||
const { parser, nodes } = require('nunjucks');
|
||||
const parsed = parser.parse(input, {}, this.nunjucksOptions);
|
||||
|
||||
return (
|
||||
parsed.children.length === 1 &&
|
||||
!(parsed.children[0] instanceof nodes.TemplateData)
|
||||
!(parsed.children[0]?.children?.[0] instanceof nodes.TemplateData)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -147,7 +148,7 @@ export class NunjucksWorkflowRunner implements WorkflowRunner {
|
||||
return JSON.parse(templated);
|
||||
}
|
||||
} catch (ex) {
|
||||
this.options.logger.error(
|
||||
console.error(
|
||||
`Failed to parse template string: ${value} with error ${ex.message}`,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user