single field author
After some trial and error, I found out that adding an author to a new zotero object, could be done like this:
newItem.creators[0].creatorType = "author";
newItem.creators[0].firstName = "John";
newItem.creators[0].lastName = "Smith";
But how do you add a single field author? i.e. an organization.
I've been trying to find some documentation on how to make a new translator, but I can't locate any that's not outdated.
It would be a great help. I would be especially grateful for an overview of the Zotero object, and a more extensive explanation of the Zotero utilities than this one: https://www.zotero.org/support/dev/translators/coding#web_translators
newItem.creators[0].creatorType = "author";
newItem.creators[0].firstName = "John";
newItem.creators[0].lastName = "Smith";
But how do you add a single field author? i.e. an organization.
I've been trying to find some documentation on how to make a new translator, but I can't locate any that's not outdated.
It would be a great help. I would be especially grateful for an overview of the Zotero object, and a more extensive explanation of the Zotero utilities than this one: https://www.zotero.org/support/dev/translators/coding#web_translators
Though it's better to push into the creator array.
newItem.creators.push({lastName: "Smith", creatorType: "author", fieldMode: 1})
or to use the ZU.cleanAuthor utility:
newItem.creators.push(ZU.cleanAuthor("Smith", "author", true))
The one you link to is the only up-to-date documentation there is. I also recommend just reading/checking existing translators as a good way to learn. Look for ones that have been updated relatively recently.
edit: fixed after fbennett's comment below.
newItem.creators.push({
lastName: "Adam Smith Inc.",
creatorType: "author",
fieldMode: 1
})
The firstName field should be blank (if it has a value, it will either be ignored, or throw an error). As far as I can tell, cleanAuthor() only supports two-field names.
I thought if you force comma=true on an author without comma, you'll get single field with cleanAuthor, but I didn't actually try this.
If you don't, maybe you should?
If it wasn't for you (and other helpful people in these forums), I would still be stuck in CSL-script, and I would never have ventured into writing a translator.
You are quick to answer, and your responses are attentive and helpful. And I just want to say, that I really appreciate it.