mirror of
https://github.com/zadam/trilium.git
synced 2025-10-26 07:46:30 +01:00
refactor(share): use internal rendering method for subtemplates
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user