refactor(share): use internal rendering method for subtemplates

This commit is contained in:
Elian Doran
2025-06-24 17:48:52 +03:00
parent a2110ca631
commit bc4643fed2

View File

@@ -185,14 +185,18 @@ function renderNoteContentInternal(note: SNote | BNote, renderArgs: RenderArgs)
// Render with the default view otherwise.
const templatePath = join(getResourceDir(), "share-theme", "templates", "page.ejs");
return ejs.render(readFileSync(templatePath, "utf-8"), opts, {
return ejs.render(readTemplate(templatePath), opts, {
includer: (path) => {
const templatePath = join(getResourceDir(), "share-theme", "templates", `${path}.ejs`);
return { filename: templatePath }
return { template: readTemplate(templatePath) };
}
});
}
function readTemplate(path: string) {
return readFileSync(path, "utf-8");
}
function getContent(note: SNote | BNote) {
if (note.isProtected) {
return {