Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Zenodo] Prevent mis-importing software as report #1578

Merged
merged 10 commits into from
Mar 9, 2018
62 changes: 61 additions & 1 deletion Zenodo.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2018-01-22 21:59:40"
"lastUpdated": "2018-03-07 14:55:24"
}

/*
Expand Down Expand Up @@ -195,6 +195,11 @@ function scrape(doc, url) {

if (item.itemType == "document" && zoteroType[type]) {
item.itemType = zoteroType[type];

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what would happen if we replace this whole thing, including l. 197 by item.itemType = detectWeb(doc, url)
That seems like a cleaner solution, provided our detect function is good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the var zoteroType block be removed as well, then?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly, yes

//undo the fix for non-existent CSL types, if Zotero supports the original itemType
if (detectWeb(doc, url) == "computerProgram") {
item.itemType = "computerProgram"
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we delete the first introduction of the variable type as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean L42 or L133? Removing the latter indeed doesn't break the tests :-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the latter one seems not necessarily anymore. We certainly still need the first one.

item.itemID = "";
item.complete();
Expand Down Expand Up @@ -469,6 +474,61 @@ var testCases = [
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://zenodo.org/record/1048320",
"items": [
{
"itemType": "computerProgram"
"creators": [
{
"lastName": "Carl Boettiger"
"firstName": ""
"creatorType": "author"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rerun the tests should yield some fieldMode fields.

{
"lastName": "Maëlle Salmon"
"firstName": ""
"creatorType": "author"
}
{
"lastName": "Noam Ross"
"firstName": ""
"creatorType": "author"
}
{
"lastName": "Arfon Smith"
"firstName": ""
"creatorType": "author"
}
{
"lastName": "Anna Krystalli"
"firstName": ""
"creatorType": "author"
}
]
"notes": []
"tags": []
"seeAlso": []
"attachments": [
{
"title": "Zenodo Snapshot"
"mimeType": "text/html"
}
]
"title": "ropensci/codemetar: codemetar: Generate CodeMeta Metadata for R Packages"
"publisher": "Zenodo"
"abstractNote": "an R package for generating and working with codemeta"
"date": "2017-11-13"
"extra": "DOI: 10.5281/zenodo.1048320"
"url": "https://zenodo.org/record/1048320"
"libraryCatalog": "Zenodo"
"accessDate": "2018-03-07T13:45:35Z"
"shortTitle": "ropensci/codemetar"
"company": "Zenodo"
}
]
}
]
/** END TEST CASES **/