From df2cf98b2294bba7cd0dc43cb53a8b7819bf089b Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Sun, 12 Jun 2022 19:44:50 +0200 Subject: [PATCH] Make images available in adoc --- lib/content/generate.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/content/generate.ts b/lib/content/generate.ts index 31e4c37..655c933 100644 --- a/lib/content/generate.ts +++ b/lib/content/generate.ts @@ -19,7 +19,9 @@ export async function generateContent(content: Project|Diary, selectedPage?: num async function generateProjectHTML(project: Project): Promise { const resp = await fetch(`/content/projects/${project.name}.adoc`); if (resp.status !== 200) return projectServerErrorHtml; - const adDoc = ad.load(await resp.text(), { attributes: { showtitle: true } }); + const rawAd = await resp.text(); + const pathsCorrected = rawAd.replace(/(image[:]+)(.*\.[a-zA-Z]+)\[/g, `$1/content/projects/data_${project.name}/$2[`); + const adDoc = ad.load(pathsCorrected, { attributes: { showtitle: true } }); return `${adDoc.convert(adDoc).toString()}