From 5620633a422884942b89e58440c8f4f3f28517fa Mon Sep 17 00:00:00 2001 From: Richard Dern Date: Thu, 6 Nov 2025 20:29:05 +0100 Subject: [PATCH] Correction de l'attribution automatique --- tools/add_lego.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/add_lego.js b/tools/add_lego.js index dce4df11..2ef1d36c 100644 --- a/tools/add_lego.js +++ b/tools/add_lego.js @@ -309,7 +309,7 @@ async function main() { const nameNoExt = base.replace(/\.[^.]+$/, ''); const yamlPath = path.join(dataImagesDir, `${nameNoExt}.yaml`); const titleForSetImage = (setDetails.name || selected.name || '').replace(/"/g, '\\"'); - const yaml = `attribution: "© Rebrickable"\n` + + const yaml = `attribution: "© [Rebrickable](https://rebrickable.com/)"\n` + `title: "${titleForSetImage}"\n`; await fs.writeFile(yamlPath, yaml, 'utf8'); } @@ -356,8 +356,12 @@ async function main() { const nameNoExt = base.replace(/\.[^.]+$/, ''); const yamlPath = path.join(dataImagesDir, `${nameNoExt}.yaml`); - const yaml = `attribution: "© Rebrickable"\n` + - `title: "${(figTitle || '').replace(/"/g, '\\"')}"\n`; + const cleanedTitle = (figTitle || '').trim(); + const yamlLines = [`attribution: "© Rebrickable"`]; + if (cleanedTitle) { + yamlLines.push(`title: "${cleanedTitle.replace(/"/g, '\\"')}"`); + } + const yaml = `${yamlLines.join('\n')}\n`; await fs.writeFile(yamlPath, yaml, 'utf8'); } }