I’m building a backend around docxtemplater. It could occur that someone provides a template with placeholders that don’t occur in the data. I made the following nullGetter so it leaves placeholders as they are.
private static nullGetter(part: Part) {
if (!part.module) return `${this.startDelimiter}${part.value}${this.endDelimiter}`;
return '';
}
The problem is that this doenst work for conditional placeholders like <#condition> Some Text . If there is no data for condition it just leaves the line blanc. I have the same problem when i want to loop tablerows. If the loop doesn’t occur in the data it just removes the table. I want it to return the document with the placeholders still in the text so the user can eassily see which placeholders are forgotten.
I tried making a custom module to handle this. But i’m not capable of doing this.