Correction de l'attribution automatique
This commit is contained in:
@@ -309,7 +309,7 @@ async function main() {
|
|||||||
const nameNoExt = base.replace(/\.[^.]+$/, '');
|
const nameNoExt = base.replace(/\.[^.]+$/, '');
|
||||||
const yamlPath = path.join(dataImagesDir, `${nameNoExt}.yaml`);
|
const yamlPath = path.join(dataImagesDir, `${nameNoExt}.yaml`);
|
||||||
const titleForSetImage = (setDetails.name || selected.name || '').replace(/"/g, '\\"');
|
const titleForSetImage = (setDetails.name || selected.name || '').replace(/"/g, '\\"');
|
||||||
const yaml = `attribution: "© Rebrickable"\n` +
|
const yaml = `attribution: "© [Rebrickable](https://rebrickable.com/)"\n` +
|
||||||
`title: "${titleForSetImage}"\n`;
|
`title: "${titleForSetImage}"\n`;
|
||||||
await fs.writeFile(yamlPath, yaml, 'utf8');
|
await fs.writeFile(yamlPath, yaml, 'utf8');
|
||||||
}
|
}
|
||||||
@@ -356,8 +356,12 @@ async function main() {
|
|||||||
|
|
||||||
const nameNoExt = base.replace(/\.[^.]+$/, '');
|
const nameNoExt = base.replace(/\.[^.]+$/, '');
|
||||||
const yamlPath = path.join(dataImagesDir, `${nameNoExt}.yaml`);
|
const yamlPath = path.join(dataImagesDir, `${nameNoExt}.yaml`);
|
||||||
const yaml = `attribution: "© Rebrickable"\n` +
|
const cleanedTitle = (figTitle || '').trim();
|
||||||
`title: "${(figTitle || '').replace(/"/g, '\\"')}"\n`;
|
const yamlLines = [`attribution: "© Rebrickable"`];
|
||||||
|
if (cleanedTitle) {
|
||||||
|
yamlLines.push(`title: "${cleanedTitle.replace(/"/g, '\\"')}"`);
|
||||||
|
}
|
||||||
|
const yaml = `${yamlLines.join('\n')}\n`;
|
||||||
await fs.writeFile(yamlPath, yaml, 'utf8');
|
await fs.writeFile(yamlPath, yaml, 'utf8');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user