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
  • Hi princeLover!
    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.
  • There's no way go thet the itemID of a Zotero item (and thus its zotero://select link) in CSL, sorry.
  • **rubisco57**

    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.
  • I am trying to extend the mentioned translator (https://github.com/rubisco57/zotCitationWithBacklink), so far with little success...
    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.
  • edited 6 days ago
    How to incorporate an existing citation style into a translator?

    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.
  • Thank you, Emiliano, for your time and advice.
    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 :/).
  • At https://gist.github.com/457380e6c7df16268dc9ba68953a6541 you will find a skeleton translator that just dumps everything a translator has access to to a JSON file. With that, you can just select entries you're interested in and see what they look like to translators.

    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.
  • edited 6 days ago

    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.

  • But given those goals, you might be done by installing https://github.com/retorquere/zotero-report-customizer once I get it fixed. It does all the things you talk about I think.
Sign In or Register to comment.