Skip to content

Commit

Permalink
Fix import bug for one contributor
Browse files Browse the repository at this point in the history
  • Loading branch information
hjonin authored and progval committed May 10, 2024
1 parent aed8ab1 commit fc06c42
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions js/codemeta_generation.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const initJsonldLoader = contexts => {
jsonld.documentLoader = getJsonldCustomLoader(contexts);
};

const getAllCodemetaContextUrls= () => {
const getAllCodemetaContextUrls = () => {
return Object.values(CODEMETA_CONTEXTS).map(context => context.url);
}

Expand Down Expand Up @@ -450,8 +450,12 @@ async function importCodemeta() {
setIfDefined(`#${key}`, value);
}

importPersons('author', 'Author', doc['author'])
importPersons('contributor', 'Contributor', doc['contributor'])
importPersons('author', 'Author', doc['author']);
if (doc['contributor']) {
// If only one contributor, it is compacted to an object
const contributors = Array.isArray(doc['contributor'])? doc['contributor'] : [doc['contributor']];
importPersons('contributor', 'Contributor', contributors);
}
}

function loadStateFromStorage() {
Expand Down

0 comments on commit fc06c42

Please sign in to comment.