Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up[Zenodo] Prevent mis-importing software as report #1578
Conversation
katrinleinweber
added some commits
Mar 7, 2018
This comment has been minimized.
This comment has been minimized.
How are you generating the tests in Scaffold? This is fine now, but to save you the work going forward, if you actually generate the test using the Scaffold testing panel, you won't get the + and - (which are from a diff display Scaffold shows). |
adam3smith
reviewed
Mar 7, 2018
@@ -195,6 +195,11 @@ function scrape(doc, url) { | |||
|
|||
if (item.itemType == "document" && zoteroType[type]) { | |||
item.itemType = zoteroType[type]; | |||
|
This comment has been minimized.
This comment has been minimized.
adam3smith
Mar 7, 2018
Collaborator
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.
This comment has been minimized.
This comment has been minimized.
katrinleinweber
Mar 7, 2018
Author
Contributor
Could the var zoteroType
block be removed as well, then?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The Zenodo item types in the CSL are fine -- they are as good as it gets for e.g. automated citation generation directly from the CSL and Zotero can customize at will in the import. For the names, we can't really parse these correctly without breaking institutional names since they're entered incorrectly in Zenodo, but we can switch fieldMode to true along the lines for
This makes them easier to fix manually. |
katrinleinweber
added some commits
Mar 7, 2018
zuphilip
reviewed
Mar 7, 2018
@@ -175,6 +175,7 @@ function scrape(doc, url) { | |||
if (!item.creators[i].firstName && item.creators[i].lastName.indexOf(",")!=-1) { | |||
item.creators[i].firstName = item.creators[i].lastName.replace(/.+?,\s*/, ""); | |||
item.creators[i].lastName = item.creators[i].lastName.replace(/,.+/, ""); | |||
item.creators[i].fieldMode = true; | |||
} |
This comment has been minimized.
This comment has been minimized.
zuphilip
Mar 7, 2018
Collaborator
Does this work? No changes in the test cases??
I think what we want is rather want is:
if (!item.creators[i].firstName) {
if (item.creators[i].lastName.indexOf(",")!=-1) {
item.creators[i].firstName = item.creators[i].lastName.replace(/.+?,\s*/, "");
item.creators[i].lastName = item.creators[i].lastName.replace(/,.+/, "");
} else {
item.creators[i].fieldMode = true;
}
}
|
||
if (item.itemType == "document" && zoteroType[type]) { | ||
item.itemType = zoteroType[type]; | ||
} |
This comment has been minimized.
This comment has been minimized.
zuphilip
Mar 7, 2018
Collaborator
Can we delete the first introduction of the variable type
as well?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
zuphilip
Mar 8, 2018
Collaborator
Yes, the latter one seems not necessarily anymore. We certainly still need the first one.
if (item.itemType == "document" && zoteroType[type]) { | ||
item.itemType = zoteroType[type]; | ||
} | ||
item.itemType = detectWeb(doc, url) |
This comment has been minimized.
This comment has been minimized.
"lastName": "Carl Boettiger" | ||
"firstName": "" | ||
"creatorType": "author" | ||
} |
This comment has been minimized.
This comment has been minimized.
katrinleinweber
added some commits
Mar 8, 2018
zuphilip
merged commit 5fa9a68
into
zotero:master
Mar 9, 2018
1 check passed
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
You're welcome, and thanks for merging :-) |
katrinleinweber commentedMar 7, 2018
•
edited
As discussed in the forum this ensures that
Software
items on Zenodo are imported ascomputerProgram
, even though along the way, Zenodo is offering a non-CSL item typePotential/Remaining isues to discuss
lastName
. This could occur in https://github.com/zotero/translators/blame/master/Zenodo.js#L172-L180, but I'm not sure whether or how to adjust that. Or, should I adjust the new test case to expectlastName
andfirstName
normally?-
and+
in thedoWeb
test output (near the bottom in the diff). Not sure what those mean, but I guess both symbols need to be removed from the JSON block.