jalvesaq / zotcite

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

:Zpdfnote not doing anything #59

Closed sh-cau closed 1 year ago

sh-cau commented 1 year ago

I am confused why this does not work. I am able to use the @ autocompletion. However, when I try to extract the highlighted text and notes from any document, nothing happens, and I do not get any error message. My :Zinfo output reads

Information from the Python module: zotero.sqlite : /home/sh/Zotero/zotero.sqlite tmpdir : /home/sh/.cache/zotcite data dir : /home/sh/Zotero zotero.py : /home/sh/repos/dotfiles/.vim/plugged/zotcite/python3/zotero.py attachments dir : references found : 2137 excluded fields : [] citation template : {Authors}_{Year} docs : {} banned words : a an the some from on in to of do with

I use the zotfile plugin to manage my files, which are stored in a nextcloud folder, but all shortcuts to receive information on a paper work just fine and also show the correct path, e.g., I am able to open the corresponding pdf with <leader>zo. Any tested file has zotero notes, and highlighted text in different colors.

What am I doing wrong or what other information do you need?

jalvesaq commented 1 year ago

Please, try again. You should get a helpful error message now.

sh-cau commented 1 year ago

Thank you for the quick response. However, the issue still remains as I have installed both python3-poppler-qt5 (v0,24,2-3build7) and python3-pyqt5 (5.14.1+dfsg-3build).

jalvesaq commented 1 year ago

Did you update the plugin? If pdfnotes.py exits with status = 0, the output is inserted in the document; and if it exits with status > 0, the output is displayed as a warning. You can run it manually to check if there is any output at all:

/path/to/zotcite/python3/pdfnotes.py document_with_annotations.pdf
sh-cau commented 1 year ago

I did update the plugin. It turns out that my installation of PyQt and/or especially of python-poppler-qt5 was faulty. However, I am unable to extract highlighted text, which is mainly what I need. Notes that were added with "Add Note" in Zotero do work now.

jalvesaq commented 1 year ago

Did you try :Znote instead of :Zpdfnote?

sh-cau commented 1 year ago

I tried both. To be clear, by highlighted text I mean highlighted text that I highlighted in Zotero itself. I tested, e.g. highlighting text using Okular and, in that case, the highlights are exported successfully using :Zpdfnote. Why or why is it not possible with highlighted text that comes from Zotero? Is there a workaround you know?

jalvesaq commented 1 year ago

I use Evince to annotate the PDF files but changed Zotero's configuration to use its own pdf viewer and, then, I noted that it doesn't change the PDF itself and doesn't create any auxiliary file in the PDF's directory. So, I suppose that it is storing the highlights and annotations in the SQL database. You can extract the annotations by right-clicking on the PDF attachment in Zotero and, then, choosing "Add Note from annotations".

jalvesaq commented 1 year ago

The note gets imported by :Znote with many HTML tags. You can get a cleaner text if you drop the note into Neovim. Then, it is pasted as Markdown which is easier to manually clean.

But it would be much better to clean the note while importing it or, even better, import the annotations directly from the SQL database. I may do either of these in the future if nobody writes a pull request for it. For now, I'm reopening the issue.

sh-cau commented 1 year ago

That's true. I am using Vim. It is also possible with zoteros Plugin MdNotes. But I think the workflow is rather cumbersome to manually extract the highlights as a note in zotero, then converting them to markdown. I agree that your suggestion would be very helpful to extract it directly from the SQL database.

jalvesaq commented 1 year ago

@sh-cau, could you please update the plugin and try :Zannotations key?

sh-cau commented 1 year ago

Beautiful, works nicely. Thank you so much!

jalvesaq commented 1 year ago

Now, it's possible to fix page numbers from :Zannotations when Zotero doesn't get them right: https://github.com/jalvesaq/zotcite/commit/913ef73ba16d5ca7e1c710515d34c36e1a8fbf6e