jalvesaq / zotcite

Neovim plugin for integration with Zotero
GNU General Public License v3.0
159 stars 13 forks source link

The possibility to extract abstract from article in notes #81

Closed adam-coates closed 1 month ago

adam-coates commented 1 month ago

As title suggests really, I have been using Obsidian recently and it also has a zotero integration that uses the bib plugin for zotero. However after looking at the sqlite database for zotero I notice that in the field itemDataValues the abstract is listed.

I am not sure the difficulties of implementing such though and how well citation keys are matched to other fields. My sqlite knowledge is limited in that sense.

jalvesaq commented 1 month ago

What use would you make of the abstract of articles? If you just want to see them quickly, <Leader>za over a citation key already allows you to do that.

adam-coates commented 1 month ago

That's true that <leader>za works and you're probably right that the abstract isn't necessary.

In my use case, I am creating note base of articles that'll be used in an upcoming publication. Therefore, the ability to have the abstract + all annotation notes contained within one document would help in fuzzy finding articles based on key words.

I'm not sure if this is beyond scope of this plugin. Im not sure if this is my laziness-to-work ethic but I was just thinking maybe a mapping to paste in the abstract from the sqlite field.

jalvesaq commented 1 month ago

It would be easy to implement. It's just a matter of extracting the "abstract" field from the same object used by <Leader>za and inserting it in the document. I will freeze the vim branch, but you could write the documentation describing how it works (and make a pull request), and I could implement it in Lua for the nvim branch. If you are willing to do this, I will immediately merge the nvim branch into the master branch.

adam-coates commented 1 month ago

Great thanks, I'll be back writing tomorrow so while having a writing break I can make a pull request. I'll make changes only to the vim branch. I see that you're rewriting the plugin in lua. This is great, thank you!

jalvesaq commented 1 month ago

I'm sorry, but I will not implement new features in the Vim branch because this would mean new bugs to fix.

jalvesaq commented 1 month ago

I updated my comment on the "issue" announcing the conversion to Lua.

adam-coates commented 1 month ago

True, yes sorry, I re-read the previous comment. Then I can write something in the documentation of the nvim branch and leave the vim branch alone.

I thought maybe having another map say <leader>zb to extract and import the abstract if its available. Happy to write the doc for that.

jalvesaq commented 1 month ago

Yes, <Leader>zb is OK.

Please, comment here when you have written the documentation. Then, I will merge the nvim branch and you will be able to make the pull request. I don't know if it's possible to make a pull request for a branch...

adam-coates commented 1 month ago

Hello, I have edited the documentation now.

I have also edited the script to actually implement this already. Perhaps it's a bit clunky and not the most intuitive way to do this but I have made efforts to follow the similar syntax.

I created a new keymap (<leader>zb) and a new function. The function uses the GetRefData python function to extract the abstractNote field and then to put this in the current buffer. I used some if else statements to catch any articles that don't have an associated abstract (this is sometimes the case in Zotero).

Let me know if I can make the pull request to the main branch and you can take a look at the code.

jalvesaq commented 1 month ago

I merged the nvim branch onto the master branch now. It's ready to receive the pull request.

adam-coates commented 1 month ago

I made a pull request now :+1: