fillOutTemplate(spec) {
        return __awaiter(this, void 0, void 0, function* () {
            //Copy data across to all the alternative formulations of a field
            spec.settings.fields.forEach(f => {
                f.alternatives.forEach(a => spec.data[a] = spec.data[f.id]);
            });
            //const template = await this.loadTemplate(spec.template);
            const filledTemplate = mustache.render(spec.settings.templateBody, spec.data);
            spec.data['templateResult'] = lib(filledTemplate).content;
            const raw_filename = mustache.render(spec.settings.templateFilename, spec.data);
            const filename = obsidian.normalizePath(raw_filename.replace(/[^a-zA-Z0-9 -:]/g, "")); //Quick and dirty regex for usable titles
            spec.data['filename'] = filename;
            const replaceText = mustache.render(spec.replacementTemplate, spec.data);
            return [filledTemplate, replaceText, filename];
        });
    }
/*
 Takes the replacement spec and creates:
 - a filled out version of the template body
 - a filled out version of the currently selected text in the editor
 */
Takes the replacement spec and creates:
a filled out version of the template body
a filled out version of the currently selected text in the editor
Takes the replacement spec and creates : a filled out version of the template body a filled out version of the currently selected text in the editor
fillOutTemplate(spec) {
        return __awaiter(this, void 0, void 0, function* () {
            spec.settings.fields.forEach(f => {
                f.alternatives.forEach(a => spec.data[a] = spec.data[f.id]);
            });
            const filledTemplate = mustache.render(spec.settings.templateBody, spec.data);
            spec.data['templateResult'] = lib(filledTemplate).content;
            const raw_filename = mustache.render(spec.settings.templateFilename, spec.data);
            const filename = obsidian.normalizePath(raw_filename.replace(/[^a-zA-Z0-9 -:]/g, "")); 
            spec.data['filename'] = filename;
            const replaceText = mustache.render(spec.replacementTemplate, spec.data);
            return [filledTemplate, replaceText, filename];
        });
    }
fillOutTemplate ( spec ) { return __awaiter ( this , void 0 , void 0 , function * ( ) { spec . settings . fields . forEach ( f => { f . alternatives . forEach ( a => spec . data [ a ] = spec . data [ f . id ] ) ; } ) ; const filledTemplate = mustache . render ( spec . settings . templateBody , spec . data ) ; spec . data [ 'templateResult' ] = lib ( filledTemplate ) . content ; const raw_filename = mustache . render ( spec . settings . templateFilename , spec . data ) ; const filename = obsidian . normalizePath ( raw_filename . replace ( / [^a-zA-Z0-9 -:] / g , "" ) ) ; spec . data [ 'filename' ] = filename ; const replaceText = mustache . render ( spec . replacementTemplate , spec . data ) ; return [ filledTemplate , replaceText , filename ] ; } ) ; }
Takes the replacement spec and creates:
 a filled out version of the template body
 a filled out version of the currently selected text in the editor
Takes the replacement spec and creates : a filled out version of the template body a filled out version of the currently selected text in the editor
//Copy data across to all the alternative formulations of a field //const template = await this.loadTemplate(spec.template); //Quick and dirty regex for usable titles