mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +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. |     // Render with the default view otherwise. | ||||||
|     const templatePath = join(getResourceDir(), "share-theme", "templates", "page.ejs"); |     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) => { |         includer: (path) => { | ||||||
|             const templatePath = join(getResourceDir(), "share-theme", "templates", `${path}.ejs`); |             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) { | function getContent(note: SNote | BNote) { | ||||||
|     if (note.isProtected) { |     if (note.isProtected) { | ||||||
|         return { |         return { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user