From be1fe5b4c378706ea934cb9529145342c7abd504 Mon Sep 17 00:00:00 2001 From: Franklin Koch Date: Wed, 15 Oct 2025 22:39:18 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=AA=20Do=20not=20add=20doi=20to=20depo?= =?UTF-8?q?sit=20if=20it=20cannot=20be=20normalized?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/fair-hotels-juggle.md | 5 +++++ src/cli/deposit.ts | 3 ++- src/conference.ts | 3 +-- src/dataset.ts | 3 +-- src/journal.ts | 2 +- src/preprint.ts | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 .changeset/fair-hotels-juggle.md diff --git a/.changeset/fair-hotels-juggle.md b/.changeset/fair-hotels-juggle.md new file mode 100644 index 0000000..8886bf6 --- /dev/null +++ b/.changeset/fair-hotels-juggle.md @@ -0,0 +1,5 @@ +--- +"crossref-utils": patch +--- + +Do not add doi to deposit if it cannot be normalized diff --git a/src/cli/deposit.ts b/src/cli/deposit.ts index c130759..35af3da 100644 --- a/src/cli/deposit.ts +++ b/src/cli/deposit.ts @@ -41,6 +41,7 @@ import { curvenoteDoiData } from '../utils.js'; import { conferencePaperFromMyst, conferenceXml } from '../conference.js'; import { contributorsXmlFromMystEditors } from '../contributors.js'; import { databaseXml, datasetFromMyst } from '../dataset.js'; +import { normalize } from 'doi-utils'; type DepositType = 'conference' | 'journal' | 'preprint' | 'dataset'; @@ -93,7 +94,7 @@ export async function depositArticleFromSource(session: ISession, depositSource: } fileContents.forEach(({ references }) => { references.cite?.order.forEach((key) => { - const value = references.cite?.data[key].doi; + const value = normalize(references.cite?.data[key].doi); if (value) dois[key] = value; else session.log.warn(`Citation without DOI excluded from crossref deposit: ${key}`); }); diff --git a/src/conference.ts b/src/conference.ts index d0f16f7..68388d3 100644 --- a/src/conference.ts +++ b/src/conference.ts @@ -2,7 +2,6 @@ import type { Element } from 'xast'; import { e } from './utils.js'; import type { ConferenceOptions, ConferencePaper } from './types.js'; import type { PageFrontmatter } from 'myst-frontmatter'; -import { normalize } from 'doi-utils'; import { contributorsXmlFromMystAuthors } from './contributors.js'; import { publicationDateXml } from './dates.js'; @@ -84,7 +83,7 @@ export function conferencePaperXml({ e( 'citation_list', Object.entries(citations).map(([key, value]) => { - return e('citation', { key }, [e('doi', normalize(value))]); + return e('citation', { key }, [e('doi', value)]); }), ), ); diff --git a/src/dataset.ts b/src/dataset.ts index e59cb80..13ad50a 100644 --- a/src/dataset.ts +++ b/src/dataset.ts @@ -2,7 +2,6 @@ import type { Element } from 'xast'; import { curvenoteDoiData, e } from './utils.js'; import type { DatabaseOptions, DatasetMetadata, Titles } from './types.js'; import type { PageFrontmatter } from 'myst-frontmatter'; -import { normalize } from 'doi-utils'; import { contributorsXmlFromMystAuthors } from './contributors.js'; import { dateXml } from './dates.js'; @@ -100,7 +99,7 @@ export function datasetXml({ e( 'citation_list', Object.entries(citations).map(([key, value]) => { - return e('citation', { key }, [e('doi', normalize(value))]); + return e('citation', { key }, [e('doi', value)]); }), ), ); diff --git a/src/journal.ts b/src/journal.ts index 079f5b5..256a3a7 100644 --- a/src/journal.ts +++ b/src/journal.ts @@ -217,7 +217,7 @@ export function journalArticleXml({ e( 'citation_list', Object.entries(citations).map(([key, value]) => { - return e('citation', { key }, [e('doi', normalize(value))]); + return e('citation', { key }, [e('doi', value)]); }), ), ); diff --git a/src/preprint.ts b/src/preprint.ts index 25d33f4..b69c89c 100644 --- a/src/preprint.ts +++ b/src/preprint.ts @@ -83,7 +83,7 @@ export function preprintXml({ e( 'citation_list', Object.entries(citations).map(([key, value]) => { - return e('citation', { key }, [e('doi', normalize(value))]); + return e('citation', { key }, [e('doi', value)]); }), ), );