Discovered that you can build a URL that auto-adds #Zotero references by doi/isbn (zotero dot org slash save), so I added a neat "Add to Zotero" link to each of my papers just for fun. It's not as automated as I want it to be yet with #QuartoPub but it's still neat https://www.andrewheiss.com/research/
@andrew You mean like this?
https://api.crossref.org/works/10.1038/nrd842/transform/application/x-bibtex
Just put anything between "works/" and "/transform" and it will return bibtex information.
Or did you mean something else?
@johnabs Oh wow, that's a super neat API function!
I'm looking for basically the reverse of that. Like with this DOI-less working paper here https://www.andrewheiss.com/research/working-papers/chaudhry-heiss-ngos-aid/#bibtex-citation I have BibTeX down at the bottom of the page. I can copy it, go to File > Import from clipboard in Zotero, and it'll add it as "Manuscript" type. I was hoping for some URL-based way to do that without copying it to the clipboard—one click and it somehow adds the publication based on the bibtex text
I see...I think there's some trouble here, unless you only care about this url based method working for your WIP papers only (rather than universally).
In this more limited case, you can use a bookmarklet. Now, I'm no expert at Javascript, but it seems that you can do the following based on the website you linked. Just save the following code as a bookmark, and you can automatically copy to your clipboard from anywhere on the page, and import to zotero from there.
It would be even easier if the zotero API had a way to save from bibtex instead of just doi, because in that case we can just wrap the bookmarklet in another function and call it a day.
Hope this provides something useful you can build on or use :)
```
javascript:navigator.clipboard.writeText(document.getElementsByClassName("sourceCode").cb1.innerText)
```
@andrew Oh, and for funsies, here's the same set of sed regular expressions that will take the raw html starting at <div class="sourceCode" and do the same thing:
```
:%s/^.*\(@.*\)<\/span>\{<span class="ot">\(.*\)<\/span>,.*/\1{\2/g
:%s/.*\{\(.*\)\}.*/\{\1\}/g
```
But the bookmarklet was a lot faster to get working 100% 😂