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 upCleanup some old code #1537
Conversation
zuphilip
added some commits
Jan 28, 2018
zuphilip
force-pushed the
zuphilip:cleanup-waits
branch
from
63eb9ed
to
c55d0e1
Jan 31, 2018
zuphilip
force-pushed the
zuphilip:cleanup-waits
branch
from
6d08b3a
to
206f5e6
Feb 1, 2018
This comment has been minimized.
This comment has been minimized.
( TODO: rename jmlr.js to the name of the label, but this will be detected as a deletion and shown as a fail in Travis test --> postponed ) |
zuphilip
added some commits
Feb 1, 2018
This comment has been minimized.
This comment has been minimized.
zuphilip
force-pushed the
zuphilip:cleanup-waits
branch
from
d7470f8
to
45ba338
Feb 11, 2018
This comment has been minimized.
This comment has been minimized.
Do you want me to review & merge this? |
This comment has been minimized.
This comment has been minimized.
Yes, that would be fine. There are some more cases, but I can pack them into a new PR. |
adam3smith
requested changes
Feb 27, 2018
Looks good, thanks for doing this! A couple of small things to do quite right while you're cleaning up. Feel free to merge yourself once they're done. |
var translator = Zotero.loadTranslator("import"); | ||
translator.setTranslator("5e3ad958-ac79-463d-812b-a86a9235c28f"); | ||
translator.setString(text); | ||
translator.setHandler("itemDone", function (obj, item) { | ||
//the DC doesn't distinguish between personal and institutional authors - get them from the page and parse | ||
var authors = ZU.xpath(doc, '//div[@id="archivalDescriptionArea"]//div[@class="field"]/h3[contains(text(), "Name of creator")]/following-sibling::div/a'); | ||
for (var i in authors) { | ||
for (let i in authors) { |
This comment has been minimized.
This comment has been minimized.
adam3smith
Feb 27, 2018
Collaborator
You're still using for ... in to cycle through an array, though...
//remove location (in parentheses) from creators, since it often contains a comma that messes with author parsing | ||
item.creators[i] = ZU.cleanAuthor(authors[i].textContent.replace(/\(.+\)\s*$/, ""), "author", true); | ||
if (!item.creators[i].firstName) item.creators[i].fieldMode = 1; | ||
} | ||
//The Archive gets mapped to the relations tag - we want its name, not the description in archeion | ||
for (var i in item.seeAlso) { | ||
for (let i in item.seeAlso) { |
This comment has been minimized.
This comment has been minimized.
} | ||
|
||
newItem.attachments.push({ | ||
url:doc.location.href, |
This comment has been minimized.
This comment has been minimized.
function getSearchResults(doc, checkOnly) { | ||
var items = {}; | ||
var found = false; | ||
// TODO: adjust the CSS selector |
This comment has been minimized.
This comment has been minimized.
"url": "http://www.louvre.fr/en/oeuvre-notices/mona-lisa-portrait-lisa-gherardini-wife-francesco-del-giocondo?sous_dept=1", | ||
"creators": [ | ||
{ | ||
"lastName": "Leonardo di ser Piero da Vinci, known as LEONARDO DA VINCI (Vinci, 1452 - Amboise, 1519)", |
This comment has been minimized.
This comment has been minimized.
adam3smith
Feb 27, 2018
Collaborator
This is never going to be perfect, but could we at least remove the date of birth&death in parentheses?
@@ -164,56 +184,55 @@ var testCases = [ | |||
"creatorType": "author" | |||
} | |||
], | |||
"notes": [], | |||
"date": "Mon Nov 14 21:16:28 UTC 2011", |
This comment has been minimized.
This comment has been minimized.
adam3smith
Feb 27, 2018
Collaborator
I'm worried how Zotero is going to parse that date. We should normalize that or remove the timestamp
This comment has been minimized.
This comment has been minimized.
Okay, I updated them, but either you or me should look over them again. I will not able to do this very soon... |
adam3smith
added some commits
Mar 15, 2018
adam3smith
approved these changes
Mar 15, 2018
adam3smith
merged commit 5bb111a
into
zotero:master
Mar 15, 2018
1 check passed
This comment has been minimized.
This comment has been minimized.
Awesome -- thanks! |
zuphilip
deleted the
zuphilip:cleanup-waits
branch
Mar 16, 2018
This comment has been minimized.
This comment has been minimized.
Thank you for the review and improvements! |
zuphilip commentedJan 28, 2018
These are in the list of translators still using
wait
, which I generated withTODO: Reuters might still need a little more work to make sure that the test case for the newspaperArticle is working.