Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd ARTnews.js #1256
Conversation
owcz
added some commits
Mar 11, 2017
adam3smith
reviewed
Mar 11, 2017
"creatorType": "author" | ||
} | ||
], | ||
"date": "01/23/16 10:35 am", |
This comment has been minimized.
This comment has been minimized.
adam3smith
Mar 11, 2017
•
Collaborator
It'd be good to transform these dates to YYYY-MM-DD to avoid confusion with different locales. I think something like
.replace(/(\d{2})\/(\d{2})\/(\d{2})/, "20$3-$1-$2")
should work, but please test.
This comment has been minimized.
This comment has been minimized.
zuphilip
Mar 11, 2017
•
Collaborator
Maybe, before that just try out whether ZU.strToISO(...)
is giving us already a nice formatted date.
@adam3smith I guess, that one of $2
should be $1
.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
owcz
Mar 11, 2017
Author
Contributor
strToISO
can handle the string but drops the time ("03/02/17 10:40 pm" => "2017-03-02"). For what it's worth, Zotero did detect and export the date correctly as it was originally ingested.
@zuphilip What's the best way to call this in FW? Zotero.Utilities.strToISO(FW.Xpath('//span[@class="date-meta"]').text())
doesn't work.
This comment has been minimized.
This comment has been minimized.
zuphilip
Mar 11, 2017
Collaborator
The date without the time is normally enough for citations when used as a publication date. The time last modified or accessed a resource might be different.
I am not sure whether you can use this function in the FW.
This comment has been minimized.
This comment has been minimized.
adam3smith
Mar 11, 2017
Collaborator
yeah, you only have a list of specified functions available for FW, so this probably doesn't work.
It should be available in a hook, though:
https://www.zotero.org/support/dev/translators/framework#post-processing_with_hooks
This comment has been minimized.
This comment has been minimized.
owcz
Mar 11, 2017
Author
Contributor
@zuphilip I can call strToISO (Zotero.Utilities.strToISO("03/02/17 10:40 pm")
works fine) but I don't know if there's a trick to calling it with FW.Xpath
adam3smith
reviewed
Mar 11, 2017
"title": "The Whitney Biennial Arrives! Here’s a Round-Up of Coverage of Artists in the Show", | ||
"creators": [ | ||
{ | ||
"firstName": "The Editors of", |
This comment has been minimized.
This comment has been minimized.
adam3smith
Mar 11, 2017
Collaborator
how common is this as the exact author string? If this comes up a lot, might be worth adding a hook that transform this into a single-field author.
This comment has been minimized.
This comment has been minimized.
owcz
Mar 11, 2017
•
Author
Contributor
Not often in my usage, but upon search, looks often enough. Is there a way to do what you mention within FW or does the whole translator need to be written out? @adam3smith
This comment has been minimized.
This comment has been minimized.
adam3smith
Mar 11, 2017
Collaborator
I know I'm saying this everywhere, but in FW, hooks are the only way to go here:
https://www.zotero.org/support/dev/translators/framework#post-processing_with_hooks
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
adam3smith
Mar 11, 2017
Collaborator
I got an e-mail with a question about single field but can't find your post. Did you figure that out or do you still need an answer?
This comment has been minimized.
This comment has been minimized.
owcz
Mar 11, 2017
Author
Contributor
Figured out out, though I don't see mention of fieldMode
in the documentation. I've had issues contributing to the Zotero wiki for a while—I'd be happy to contribute what I've learned if the wiki were, for instance, on Github
This comment has been minimized.
This comment has been minimized.
adam3smith
Mar 11, 2017
Collaborator
as in you can't log in with edit access or something else? There was so much vandalism, that Zotero devs need to give you access individually (I thought they did that for you?). Post to the forums with a link to this post.
This comment has been minimized.
This comment has been minimized.
owcz
Mar 12, 2017
Author
Contributor
I log in but don't have write access again—I'll work it out with Dan but just wonder if it wouldn't be easier with another (more accessible) platform
owcz
added some commits
Mar 11, 2017
adam3smith
requested changes
Mar 11, 2017
last nit |
tags : FW.Xpath('//span[@class="cat-links"]/a').text(), | ||
hooks : { "scraperDone": function (item,doc,url) { | ||
if (item.creators[0].lastName == "ARTnews") { | ||
item.creators[0].lastName = "The Editors of ARTnews"; |
This comment has been minimized.
This comment has been minimized.
adam3smith
Mar 11, 2017
Collaborator
you need to remove the firstName
here still (I think you can just do that with delete
but I always get confused about removing items from objects.
This comment has been minimized.
This comment has been minimized.
owcz
added some commits
Mar 12, 2017
adam3smith
merged commit 21d4b8c
into
zotero:master
Mar 12, 2017
1 check passed
This comment has been minimized.
This comment has been minimized.
Great, thanks! |
owcz commentedMar 11, 2017
No description provided.