Skip to content

Commit

Permalink
❓ journal title can be optionally added
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejpurves committed Sep 12, 2024
1 parent c064f2a commit da3b548
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
16 changes: 11 additions & 5 deletions packages/web/src/pmcFromManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,18 @@ function treeFromManifest(manifest: AAMDepositManifest) {
validatePMCFunder(funding.funder);
});

const children = [
e('journal-meta', [
e('issn', { 'issn-type': manifest.metadata.journal.issnType }, [
t(manifest.metadata.journal.issn),
]),
const journalMeta = e('journal-meta', [
e('issn', { 'issn-type': manifest.metadata.journal.issnType }, [
t(manifest.metadata.journal.issn),
]),
]);

if (manifest.metadata.journal.title) {
journalMeta.children.push(e('journal-title', [t(manifest.metadata.journal.title)]));
}

const children = [
journalMeta,
e('manuscript-title', [t(manifest.metadata.title)]),
e('contacts', [
e('person', {
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/schema/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const fileSchema = z.object({
const journalSchema = z.object({
issn: z.string().min(1),
issnType: z.enum(['print', 'electronic']),
title: z.string().min(1),
shortTitle: z.string().min(1),
title: z.string().optional(),
shortTitle: z.string().optional(),
});

// Schema for the 'authors' array
Expand Down
9 changes: 3 additions & 6 deletions site/app/components/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"taskId": "task-1234",
"agency": "hhmi",
"files": [
{
Expand Down Expand Up @@ -39,10 +38,8 @@
"metadata": {
"title": "My Research Article",
"journal": {
"issn": "1234-567",
"issnType": "electronic",
"title": "Journal",
"shortTitle": "J."
"issn": "0094-6354",
"issnType": "print"
},
"authors": [
{
Expand All @@ -52,6 +49,6 @@
"contactType": "reviewer"
}
],
"funding": [{ "funder": "hhmi" }, { "funder": "nih", "grantId": "q1w2e3r4" }]
"funding": [{ "funder": "hhmi" }, { "funder": "nih", "grantId": "5R33MH125126-04" }]
}
}

0 comments on commit da3b548

Please sign in to comment.