i often face the problem that I have a couple of papers imported from ArXiv which will later be published at a conference. So I would like to keep all my notes, relations and tags for the paper/the item but replace all the items information with the original published version. Therefore I look up the bibtex stuff in the internet and copy to clipboard. In the next step I would like to overwrite all the fields of the item with the bibtex from the clipboard. Is this complicated to implement? Sadly I did not found any documentation of the Zotero Plugin API nor any nice and clear examples on how to parse BibTex and how to set an item fields.
My current workaround:
"File -> Import from Clipboard"
And then mark every field and copy it to the original item
Remove the imported item
So my questions:
Is this already implement somewhere and i just did found it?
Do you have any good Zotero Plugin API documentation?
Does anyone else have this problem?
What is the "already included" "standard' method to parse BibTex?
How to I set fields of an item?
Reference:
I asked this question previously in the Better BibTex Repo: Issue 1885 but as I start writing code for Zutilo and I guess it matches Zutilo better I decided to move it here.
Code:
I already managed to get a menuitem in the right-click menu of a bib item. I also managed to get the text of the clipboard. But i failed to get the translator working. That is my current code for the menuitem click action:
pasteBibTex: function() {
/* Function to parse the BibTex in the clipboard and overwrite all the contained
fields in the selected item. */
var zitems = this.getSelectedItems(['regular']);
if (!this.checkItemNumber(zitems, 'regularNoteAttachment1')) {
return false;
}
var clipboardText = ZutiloChrome.getFromClipboard().trim()
if (!clipboardText) {
return false;
}
var translation = new Zotero.Translate.Import();
translation.setString(str);
Zotero.log(translation.translate());
/*for (let zitem of zitems) {
zitem.setString(clipboardText);
zitem.saveTx()
}
*/
return true;
}
I am not sure if Zotero.Translate.Import() is the correct Translator because I don't really want to import something. But I didn't found any snippet on how to parse BibTex and how to set fields of a zitem. What ever a zitem is.
Hey,
i often face the problem that I have a couple of papers imported from ArXiv which will later be published at a conference. So I would like to keep all my notes, relations and tags for the paper/the item but replace all the items information with the original published version. Therefore I look up the bibtex stuff in the internet and copy to clipboard. In the next step I would like to overwrite all the fields of the item with the bibtex from the clipboard. Is this complicated to implement? Sadly I did not found any documentation of the Zotero Plugin API nor any nice and clear examples on how to parse BibTex and how to set an item fields.
My current workaround:
So my questions:
Reference:
I asked this question previously in the Better BibTex Repo: Issue 1885 but as I start writing code for Zutilo and I guess it matches Zutilo better I decided to move it here.
Code:
I already managed to get a menuitem in the right-click menu of a bib item. I also managed to get the text of the clipboard. But i failed to get the translator working. That is my current code for the menuitem click action:
I am not sure if
Zotero.Translate.Import()
is the correct Translator because I don't really want to import something. But I didn't found any snippet on how to parse BibTex and how to set fields of azitem
. What ever azitem
is.