API to enable plugins like Zotero

@Amcmo: That’s well out of line.

I posted a gentle suggestion, based on a decade of largely solo work on related technology. If anyone is sympathetic to Keith’s position here, it’s me. I offered to help with this facility if he is interested. It was my second post to this forum in three and half years. I would be very surprised if he took offense, and I am sure he can make his own decision on the suggestion and the offer without your assistance.

For what it’s worth, I did read the BEFORE POSTING notes …

… and I couldn’t have said it better myself.

@fbennett: thank you for contributing. Having a library like citeproc would greatly simplify Keith’s work, and I suppose it would be incredibly useful if you could share more details on how a developer could use it. The benefit of citeproc is that it is not tied to Zotero right (bib file + csl is sufficient)? I use Pandoc-citeproc to automagically compile all my docs so integration is personally useless, but some users are resistant to installing it. Scrivener cannot bundle Pandoc as it is large, and so somehow embedding citeproc without pandoc would be a possibility? Can citeproc-js use a built-in JS engine (I assume webkit) or does it need to bundle this too?

I’m talking about this to trigger only during compile, not some CWYW interface which is complex and (IMO) not needed…

citeproc doesn’t need a UI; webkit would certainly do, but anything that can run reasonably recent javascript (such as node) would work. citeproc-js could replace pandoc-citeproc, but citeproc-js does “only” citation rendering, you’d still need reference management and citation inserting. Reference management is non-trivial work, which is why people use tools like Zotero. No need to replicate those.

I cannot speak for how complex CWYW would be to build into Scrivener, but a bunch of users already do something of the kind where they have simple scripts that calls the URL described at https://retorque.re/zotero-better-bibtex/cayw/ and paste the pandoc-formatted (or a number of other formats at your choice) result on the cmd+Y hotkey that Scrivener already has for citations. It’s simple enough that if you open localhost:23119/better-bibtex/cayw?format=pandoc in your browser, the picker will pop up, and you’ll get the pandoc-formatted citations in your browser. I get to hear from that bunch of users because I wrote the entrypoint to fetch the citations from Zotero. A single HTTP-GET request gets you the citations to insert. This is not a demand that it be done (calm down people :unamused: ), but there are other opinions out there that do think it’s needed, to the point that they’ll hack together 10-liner scripts to do it.

Perhaps the subject to this topic is just wrong – the people I hear from don’t even want an API, they want a clean way to get their citations into Scrivener, much like the well-worn saying that people don’t want drills, but holes in their walls. The request for an API is the developers way of saying “I don’t need you to accommodate me specifically – if you give me the tools, I’ll gladly do the work myself and leave you to yours”. It’s meant to put less work on the Scrivener devs, not more. But minimally, a simple “fetch URL and paste into current position” would do the job.

What Emiliano says above too, but here’s a response on some of the citeproc-js specifics.

Documentation for the processor is available at http://citeproc-js.readthedocs.io/en/latest/index.html, with three demos to play with that show how input/output works.

Yes. It just needs input data and style files to do its work. The items for input data are identified by a key, so the simple thing would be to set the key with in-document refs, and pull the input data from wherever (Zotero is what I know, but glue code could be written for any reference manager or archive with well-structured data and an API).

I don’t know what components Scrivener has in place internally, but WebKit is the JS engine that I normally use to run the processor test suite before releases. It should work with any available JS engine.

Yes, that’s what I would assume. As Emiliano says above, a simple item-picker to insert reference codes into the document would be minimally intrusive, both inside Scrivener and as a user experience. It could support both pandoc and native Zotero (or whatever) IDs.

Getting IDs into the document with less distracting back-and-forth to another application would be a big gain. Getting further ahead of myself, if citeproc-js were used to batch-process IDs into citations on export, that would also be a step-saver. If the exported citations were wrapped in field codes (in ODF export) or reference marks (in DOCX export), they could be round-tripped back to simple Scrivener cite blobs on reimport. There wouldn’t be a need to convert them into fully dynamic Zotero citations, with the support burdens that would entail.

That’s a load of armchair quarterbacking, but the main point is that the impact on Scrivener internals could be kept to a minimum if there were no dynamic updates to cite forms—and given the shape of Scrivener workflows, that seems unnecessary.

Anyway, thoughts.

Hardly out of line. While I understand anyone wanting to see a new feature (i’d Like Grammarly integration), once it has been discussed at length and an L&L response I feel it a waste of breath and bandwidth to belabour the point.
Yes, I know Grammarly works great with Word, but Scrivener is the best long form editor, so I don’t bother going on about using Word instead as if that somehow gives weight to my argument.
my comment was not intended as a personal attack on any particular poster, more a frustration at something that appears ongoing, demands for enahancements, threats to use another program etc that crop up regularly.

I have to admit that I do use several other programs, and so far neither Scrivener nor L&L have protested or seem to have seen it as threatening.
:slight_smile:

Threatening not to use Scrivener is somewhat silly. I mean, those that post such threats, they have already paid for Scrivener, right? So L&L doesn’t really lose anything.

There seems to be a good deal of enthusiasm for an end to all discussion here. So in the spirit of the local culture, I’ll conclude with a memorable punch line from the great Carol Burnett:

There. Fixed the thread for you. No extra charge.

Umm… last I checked, you are not a moderator. If you feel a thread needs to be reported, you may certainly do so. If you feel a topic has been done to death, you can also simply ignore it.

Attacking someone who offers a serious suggestion on a topic of common interest is indeed out of line. Please stop.

Katherine

fbennett and retorque: We should possibly consider this should be a new wishlist item, that is not specific to Zotero, and not a general API. I think that there is merit to a focussed request to add citeproc to the compiler for Scrivener.

In terms of a UI to add citations, I really do think that unless we can build a universal mechanism that is ref manager agnostic, it should not be added to Scrivener. There are many tools to do this (I use both ⌘Y round trip and an Alfred workflow floating window that searches my Bookends Database in real time; zotero has its options, papers3 magic citations etc.), and if Scrivener added a native trigger it simply could not do it agnostically, and therefore should not be done IMO.

BUT all reference managers can export a BibTeX database, bib and csl files can be stored in the binder, and a Compiler citeproc integration would benefit all academic users…

@nontroppo: Certainly want to avoid feature bloat, but do note that BibTeX can’t really handle multilingual or legal references (the former, at least, figures in Oren Patashnik’s TUGBoat piece on BibTeX 2.0, but that never happened). CSL JSON is the only transfer format I know of that attempts to cover both. If those realms (multilingual and law) are of any interest, keeping that open as an import format option would make sense (simple, b/c that’s what the processor digests anyway). Simple is beautiful. Hope it works out.

With regard to an API for Scrivener, I’m afraid this is highly unlikely to happen. It’s not that it’s not a good idea, quite the contrary, just that with our limited resources and coders it would be very, very difficult to implement and maintain.

All the best,
Keith

@KB Thanks for responding, it’s your call. I won’t be posting to this forum again, but if the position changes just give a shout. I can be reached via the Juris-M project (juris-m.github.io/).

I’ve written up a much more restricted wish list request to add bibliography generation via citeproc here: viewtopic.php?f=4&t=51779

Umm, Katherine, last time I checked, one didn’t have to be a moderator to have an opinion. If you re-read my comment it was not an attack on any person.

Regardless, you’ve made your opinion abundantly clear, (Privilege of being a moderator I guess) so consider this the final post of a previous Scrivener evangelist.

I seriously hope this will not be your final post Amcmo, as you are a valued member of the forum!