Add front matter with IDs

This commit is contained in:
Emmanuel 2024-12-05 08:14:44 +01:00
parent 79ddfbbfd6
commit 0b9575c77c

View file

@ -413,6 +413,7 @@ async function exportLegiTexteToMarkdown(
async function generateGitDirectory( async function generateGitDirectory(
context: Context, context: Context,
depth: number, depth: number,
id: string,
title: string, title: string,
liensArticles: LegiSectionTaLienArt[] | undefined, liensArticles: LegiSectionTaLienArt[] | undefined,
liensSectionTa: LegiSectionTaLienSectionTa[] | undefined, liensSectionTa: LegiSectionTaLienSectionTa[] | undefined,
@ -455,6 +456,10 @@ async function generateGitDirectory(
await fs.writeFile( await fs.writeFile(
path.join(context.targetDir, articleRepositoryRelativeFilePath), path.join(context.targetDir, articleRepositoryRelativeFilePath),
dedent` dedent`
---
ID: ${articleId}
---
###### ${articleTitle} ###### ${articleTitle}
${article.BLOC_TEXTUEL?.CONTENU} ${article.BLOC_TEXTUEL?.CONTENU}
@ -510,6 +515,10 @@ async function generateGitDirectory(
await fs.writeFile( await fs.writeFile(
path.join(context.targetDir, readmeRepositoryRelativeFilePath), path.join(context.targetDir, readmeRepositoryRelativeFilePath),
dedent` dedent`
---
ID: ${id}
---
${"#".repeat(Math.min(depth, 6))} ${title} ${"#".repeat(Math.min(depth, 6))} ${title}
${readmeLinks.map(({ href, title }) => `- [${title}](${href})`).join("\n")} ${readmeLinks.map(({ href, title }) => `- [${title}](${href})`).join("\n")}
@ -541,6 +550,7 @@ async function generateGitDirectory(
await generateGitDirectory( await generateGitDirectory(
context, context,
depth + 1, depth + 1,
sectionTaId,
sectionTaTitle, sectionTaTitle,
sectionTa?.STRUCTURE_TA?.LIEN_ART, sectionTa?.STRUCTURE_TA?.LIEN_ART,
sectionTa?.STRUCTURE_TA?.LIEN_SECTION_TA, sectionTa?.STRUCTURE_TA?.LIEN_SECTION_TA,