Skip to content

Commit 2941af8

Browse files
authored
🪪 Do not add doi to deposit if it cannot be normalized (#19)
1 parent ba71393 commit 2941af8

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"crossref-utils": patch
3+
---
4+
5+
Do not add doi to deposit if it cannot be normalized

‎src/cli/deposit.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import { curvenoteDoiData } from '../utils.js';
4141
import { conferencePaperFromMyst, conferenceXml } from '../conference.js';
4242
import { contributorsXmlFromMystEditors } from '../contributors.js';
4343
import { databaseXml, datasetFromMyst } from '../dataset.js';
44+
import { normalize } from 'doi-utils';
4445

4546
type DepositType = 'conference' | 'journal' | 'preprint' | 'dataset';
4647

@@ -93,7 +94,7 @@ export async function depositArticleFromSource(session: ISession, depositSource:
9394
}
9495
fileContents.forEach(({ references }) => {
9596
references.cite?.order.forEach((key) => {
96-
const value = references.cite?.data[key].doi;
97+
const value = normalize(references.cite?.data[key].doi);
9798
if (value) dois[key] = value;
9899
else session.log.warn(`Citation without DOI excluded from crossref deposit: ${key}`);
99100
});

‎src/conference.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { Element } from 'xast';
22
import { e } from './utils.js';
33
import type { ConferenceOptions, ConferencePaper } from './types.js';
44
import type { PageFrontmatter } from 'myst-frontmatter';
5-
import { normalize } from 'doi-utils';
65
import { contributorsXmlFromMystAuthors } from './contributors.js';
76
import { publicationDateXml } from './dates.js';
87

@@ -84,7 +83,7 @@ export function conferencePaperXml({
8483
e(
8584
'citation_list',
8685
Object.entries(citations).map(([key, value]) => {
87-
return e('citation', { key }, [e('doi', normalize(value))]);
86+
return e('citation', { key }, [e('doi', value)]);
8887
}),
8988
),
9089
);

‎src/dataset.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { Element } from 'xast';
22
import { curvenoteDoiData, e } from './utils.js';
33
import type { DatabaseOptions, DatasetMetadata, Titles } from './types.js';
44
import type { PageFrontmatter } from 'myst-frontmatter';
5-
import { normalize } from 'doi-utils';
65
import { contributorsXmlFromMystAuthors } from './contributors.js';
76
import { dateXml } from './dates.js';
87

@@ -100,7 +99,7 @@ export function datasetXml({
10099
e(
101100
'citation_list',
102101
Object.entries(citations).map(([key, value]) => {
103-
return e('citation', { key }, [e('doi', normalize(value))]);
102+
return e('citation', { key }, [e('doi', value)]);
104103
}),
105104
),
106105
);

‎src/journal.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export function journalArticleXml({
217217
e(
218218
'citation_list',
219219
Object.entries(citations).map(([key, value]) => {
220-
return e('citation', { key }, [e('doi', normalize(value))]);
220+
return e('citation', { key }, [e('doi', value)]);
221221
}),
222222
),
223223
);

‎src/preprint.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export function preprintXml({
8383
e(
8484
'citation_list',
8585
Object.entries(citations).map(([key, value]) => {
86-
return e('citation', { key }, [e('doi', normalize(value))]);
86+
return e('citation', { key }, [e('doi', value)]);
8787
}),
8888
),
8989
);

0 commit comments

Comments
 (0)