zotxt-emacs icon indicating copy to clipboard operation
zotxt-emacs copied to clipboard

Add option to insert citations in place of bibliography entries

Open plandes opened this issue 2 years ago • 2 comments

What this adds is summarized in the new customized variable zotxt-default-format:

If this value is set to a string, a citation is created. In this case, the string contains paths encoded with curly braces ({}) contain dot separated paths used to substitute from the JSON retrieved from the entry from Zotero. This is either the JSON key, or if a number, the Nth entry in the list. For example, the string: "{author.0.0.family} et al. ({issued.0.date-parts.0.0})"

Creates a string like "Hetzner (2022)".

The following changes are:

  • Rename the function zotxt-get-item-bibliography-deferred to zotxt-get-item-formatted-deferred in zotxt.el and the test case.
  • Add the function zotxt-get-item-format-bibliography to take the place of the bibliography item updates.
  • Add the function zotxt-traverse-tree. Since this is a recursive function, and can't be "hidden" nicely in an cl-flet.
  • Add the functions zotxt-get-item-format-citation and zotxt-get-item-format-item to format the citation text.

plandes avatar Aug 13 '22 21:08 plandes

Let me know if there's anything I can do help in getting this folded in.

plandes avatar Sep 17 '24 22:09 plandes

@plandes Thanks for this, and apologies for the delay! I'd be happy to merge this. I have one question: I'd really like to move zotxt forward to using built in org citations where possible. This seems like kind of a parallel direction - do you think it would be a blocker to org citations, or is it just a parallel track?

egh avatar Sep 19 '24 16:09 egh

Pull Request Merge

@egh Please don't apologize, we're all busy with a hundred different things competing for our attention :)

Re Org Mode citations: I just took a cursory look and I do believe org-zotxt could act as a plugin to compliment its current API. However, I do think that would be significant work to make everything play nice together (specifically keep the existing Org Mode functionality working while adding in Zotero URLs). For this reason, my recommendation would be to merge this, and then we can tackle Org Mode citations later as time permits and perhaps in another branch.

Website Export/Creation Integration

While we are talking about non-trivial changes, there could be more opportunity to add in functionality to open paper PDFs directly from Emacs and use an Org Mode export with zotero links replaced with http links that point to an exported website. My process is:

  1. Use zotsite to create a website version Zotero.
  2. Use org-zotxt to create Org Mode Zotero links (zotero://item/<key>) in Org Mode files.
  3. Use the Org Mode publish framework to create twitter bootstrap websites or the Org Mode file(s).

This creates a website of the Org Mode file that links directly to papers. The zotsite program also gives locations of papers on the file system to browse directly to them while in Emacs.

Thoughts?

plandes avatar Sep 22 '24 14:09 plandes

Thanks for the update. I'm not quite sure how the second process would work - I use org-publish to maintain a website, but I've never considered hooking it up to Zotero. I don't have any advice to give here, but it sounds like a great idea!

egh avatar Sep 22 '24 17:09 egh

@egh I just added the Emacs Org Publish zotmacs repo to shed some light on the second process. It uses org-export-filter-link-functions to replace Org Mode links and redefines org-zotxt--link-follow to browse to local file system content.

plandes avatar Sep 22 '24 17:09 plandes

Thank you! I will take a look.

egh avatar Sep 24 '24 17:09 egh