diff --git a/src/services/githubImporter.js b/src/services/githubImporter.js index 5773f87..3ce8ddf 100644 --- a/src/services/githubImporter.js +++ b/src/services/githubImporter.js @@ -282,7 +282,7 @@ export function parseCitationCff(text) { const inlineMatch = inline.match(/^([A-Za-z0-9_-]+):\s*(.*)$/); if (inlineMatch) { const [, key, value] = inlineMatch; - currentAuthor[key] = cleanString(value).replace(/^"|"$/g, ''); + currentAuthor[key] = stripWrappingQuotes(value); } continue; } @@ -291,7 +291,7 @@ export function parseCitationCff(text) { const authorMatch = trimmed.match(/^([A-Za-z0-9_-]+):\s*(.*)$/); if (authorMatch) { const [, key, value] = authorMatch; - currentAuthor[key] = cleanString(value).replace(/^"|"$/g, ''); + currentAuthor[key] = stripWrappingQuotes(value); } } diff --git a/tests/services/githubImporter.test.js b/tests/services/githubImporter.test.js index 55df6c5..83fbd12 100644 --- a/tests/services/githubImporter.test.js +++ b/tests/services/githubImporter.test.js @@ -146,6 +146,20 @@ references: assert.deepEqual(parsed.references, ['https://doi.org/10.1000/xyz123', 'https://example.org/paper']); }); +test('parseCitationCff strips single quotes from author fields', () => { + const parsed = parseCitationCff(`cff-version: 1.2.0 +authors: + - family-names: 'Zissou' + given-names: 'Matthew J' + orcid: 'https://orcid.org/0000-0003-2664-451X' +`); + + assert.equal(parsed.authors.length, 1); + assert.equal(parsed.authors[0].givenNames, 'Matthew J'); + assert.equal(parsed.authors[0].familyNames, 'Zissou'); + assert.equal(parsed.authors[0].orcid, 'https://orcid.org/0000-0003-2664-451X'); +}); + test('parseZenodoJson extracts grants and references from zenodo metadata', () => { const parsed = parseZenodoJson(JSON.stringify({ title: 'OpenCite',