Make images available in adoc

This commit is contained in:
Daniel Kluge 2022-06-12 19:44:50 +02:00
parent 61a9481ddf
commit df2cf98b22

View File

@ -19,7 +19,9 @@ export async function generateContent(content: Project|Diary, selectedPage?: num
async function generateProjectHTML(project: Project): Promise<string> {
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()}
<hr>
<div id="footer">