Backlinks to Zotero entries in bibliographic references
Hello! Is it possible to make a bibliographic style that will automatically include backlinks to original entries in Zotero library? Something like this:
---
Knuth, D. E. (1984). The TeX book. In Computers & Typesetting: Vol. A. Addison-Wesley. [zotero://select/library/items/LRXH2KUZ]
Knuth, D. E. (1984–1986). Computers & Typesetting (Vol. 1–5). Addison-Wesley. [zotero://select/library/items/NC9ZM4JQ]
---
I know that I can manually put `ABCD1234` from `zotero://select/library/items/ABCD1234` in one of the rarely used general fields and then grab it from this field using CSL, but maybe there is a way to automate this? Is there a magic variable that I could include in the output template? I just don’t want to manually use `Copy select item links` function from Zutilo every time I need it.
Sorry for my English, I hope that I was able to more or less clearly convey my point :D
---
Knuth, D. E. (1984). The TeX book. In Computers & Typesetting: Vol. A. Addison-Wesley. [zotero://select/library/items/LRXH2KUZ]
Knuth, D. E. (1984–1986). Computers & Typesetting (Vol. 1–5). Addison-Wesley. [zotero://select/library/items/NC9ZM4JQ]
---
I know that I can manually put `ABCD1234` from `zotero://select/library/items/ABCD1234` in one of the rarely used general fields and then grab it from this field using CSL, but maybe there is a way to automate this? Is there a magic variable that I could include in the output template? I just don’t want to manually use `Copy select item links` function from Zutilo every time I need it.
Sorry for my English, I hope that I was able to more or less clearly convey my point :D
I am looking for a similar solution. Are you currently using the quick copy shortcut to export your citations? If so, you might want to give this translator a try: https://gist.github.com/nschneid/3134386 – it does not use a predefined citation style though and only brings the consultant to the library item.
I just modified one of Chicago styles a little, so that the value from the Rights field where I keep Item IDs is substituted into formatted bibliography, when I run the Create Bibliography function. Anyway, thanks for you solution!
**adamsmith**
Thanks for your reply! That's okay, Zotero is already a great piece of software.
If you or anyone else would like to share your thoughts with views to my questions (https://github.com/rubisco57/zotCitationWithBacklink#questionsissues), I would be thankful.
Not possible within the translator framework. Could be done with a companion plugin.
Can a window for user interaction (entry of page number) be brought up from within a translator?
Not possible within the translator framework. Could be done with a companion plugin.
How to get an item's attachment when it has not been directly selected and retrieve its ID?
The translator gets the selected item(s) and all their attachments regardless of whether the attachments were selected. The info you get on the attachments includes their ID.
Edit: "could be done with a companion plugin" means that said companion plugin would implement a number of monkey patches to change Zotero's behavior. This is often unpretty and always fragile, and could destabilize Zotero. You'll also have to get pretty familiar with Zotero's source code and be willing to refit your work when Zotero changes. My own plugin started as a companion plugin to a translator, and it's a ton of work. I'd not recommend doing this unless there's absolutely no other way.
Plug-in development may be an option in the future, but seems to involve, especially for a novice to the Zotero project, tons of work. I will thus hard code the desired citation style in the translator and use AutoHotkey for the user interaction as an interim solution.
Maybe you or someone else could refer me to the part of the project that is relevant to the the translator framework, i.e. that allows to to deduce which methods are applicable to the object 'item' ... for now, I am just guessing (e.g. item.attachments but then, how to proceed :/).
You can use all synchronous javascript you want (so no promises, await, setTimeout etc) and Zotero offers some utility functions as "Zotero.Utilities.X" that you can call, but I don't know where they're documented, I mostly just crib from other translators or I look in the Zotero source.
WRT the goals you outline in https://github.com/rubisco57/zotCitationWithBacklink... The citation part is technically possible within the translator framework, but take the following more as a If-you-want-to-go-there-here's-how than an actual recommendation to do this. That said:
Install node, webpack and citeproc. Zotero offers translators a method
ZU.itemToCSLJSON(item)
to transform the items you get as per the translator I posted above into CSL object. In your translator, feed these CSL objects to the citeproc you bundled with a style of your choosing, and hey presto, formatted citations.By my personal estimate this wouldn't be an easy hello-world effort. If this is your first time in Javascript, it's going to require a significant effort. Docs for citeproc are here.