zotxt-emacs
zotxt-emacs copied to clipboard
Add option to insert citations in place of bibliography entries
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
tozotxt-get-item-formatted-deferred
inzotxt.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 ancl-flet
. - Add the functions
zotxt-get-item-format-citation
andzotxt-get-item-format-item
to format the citation text.
Let me know if there's anything I can do help in getting this folded in.
@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?
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:
- Use zotsite to create a website version Zotero.
- Use
org-zotxt
to create Org Mode Zotero links (zotero://item/<key>
) in Org Mode files. - 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?
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 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.
Thank you! I will take a look.