Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fair-hotels-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"crossref-utils": patch
---

Do not add doi to deposit if it cannot be normalized
3 changes: 2 additions & 1 deletion src/cli/deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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}`);
});
Expand Down
3 changes: 1 addition & 2 deletions src/conference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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)]);
}),
),
);
Expand Down
3 changes: 1 addition & 2 deletions src/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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)]);
}),
),
);
Expand Down
2 changes: 1 addition & 1 deletion src/journal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)]);
}),
),
);
Expand Down
2 changes: 1 addition & 1 deletion src/preprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)]);
}),
),
);
Expand Down