import { FoamError } from '../common/errors'; import { URI } from '../model/uri'; import { Template, TemplateContext, NoteCreationResult, } from './note-creation-types'; import { extractFoamTemplateFrontmatterMetadata } from '../utils/template-frontmatter-parser'; import { JSTemplateLoader } from './js-template-loader'; /** * Utility for loading templates from file paths and converting them to Template objects */ export class TemplateLoader { private jsTemplateLoader: JSTemplateLoader; constructor( private readonly readFile: (uri: URI) => Promise, private readonly isTrusted: boolean ) { this.jsTemplateLoader = new JSTemplateLoader(readFile); } /** * Loads a template from a file path * @param template Path to the template file (relative or absolute) * @returns Promise resolving to a Template object */ async loadTemplate(template: URI): Promise