jalvesaq / zotcite

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

error on knitting #11

Closed olesendan closed 4 years ago

olesendan commented 5 years ago

Hi Jalvesaq

I'm getting a problem when I'm knitting a Rmd

It's throwing this error message.

[WARNING] Could not parse YAML metadata at line 681 column 1: :51:25: Unexpected ' ' Traceback (most recent call last): File "/home/dano/.local/share/nvim/site/plugged/zotcite/python3/zotref", line 54, in <module> j['meta']['references'] = refj['meta']['references'] KeyError: 'references' Error running filter zotref: Filter returned error status 1 Error: pandoc document conversion failed with error 83

I've pinpointed it to somrthing related to references. If I remove a specific reference in a minimal not working Rmd, it knits, but when I reenter the citation(with the suggested from nvim-r), it fails. If I use za I get information i nvim about the reference.

I'm missing something, but can not understand what.

Greetings from denmark Dan Olesen

jalvesaq commented 5 years ago

It seems that there is a line break in a reference. The command `:Zrefs' will add the references to the markdown document. Of course, it will be better if the cursor is in the YAML header. Then, you will be able to examine the references and look for something that might be causing the problem.

olesendan commented 5 years ago

Hi Jalvesaq.

Thank you, for your time.

I've made an small test, the references is here under. The one which is failing, is with BOLD id. The only difference I see, is attachments, where the one who is failing, have a mix of a stored copy and a linked file.

Would you think, that zotcite looks at where the files for the ciation is?

`references:

jalvesaq commented 5 years ago

I created a markdown document, added the fields above to its YAML header, deleted bold (from the id field) and italic (from the attachment fields) marks and compiled the document with the command:

pandoc -F pandoc-citeproc file.md -o file.html -s

The HTML file was generated without errors.

olesendan commented 5 years ago

Ok. It's something I'm doing. I notice a difference in your compiling.

I have this in my YAML header, on seperate lines, but here it shows on one line. output: pdf_document: pandoc_args: ['-F', 'zotref', '-F', 'pandoc-citeproc']

Does this make a difference?

jalvesaq commented 5 years ago

This is what I recommend in the README, but actually I usually use a Makefile wich runs pandoc with the same arguments.

olesendan commented 5 years ago

I have read about Makefiles, but do not know anything how to use them.

I see now, that my workflow is completly different. I'm trying the following:

I compiling from a master.Rmd, with all chapters as child documents.

I will try to make some minimal tests, will let you know the results.

jalvesaq commented 5 years ago

I don't use a Makefile when editing an Rmd, only when editing pure Markdown.

olesendan commented 5 years ago

Hi I have made the following test. first I made an test.md with the code underneath. If fails with this command pandoc -F pandoc-citeproc test.md -o test.pdf -s

But if I remove "note: "PMID: 17887811 and indent arXiv, Place and ISBN from the citation (edit: on github It's shown as being indented, but it's not when it gomes from :zrefs) id: 8CWGKG2C#Midgley_Mcnaughton_Jones_2007" it works.

when it fails, I get this error: [WARNING] Could not parse YAML metadata at line 67 column 1: :41:25: Unexpected ' ' pandoc-citeproc: reference NQP27KGC#Mcardle_2010 not found pandoc-citeproc: reference FZCRCNQ3#Abbiss_Laursen_2005 not found pandoc-citeproc: reference 8CWGKG2C#Midgley_Mcnaughton_Jones_2007 not found

The strange thing is, that I have setup Better Bibtex in Zotero not to export note. (edited). From what I can see, The only place "PMID: 17887811" is listed in that citation is in the field "Extra"


output: pdf_document: latex_engine: xelatex

references:

Teori

[@NQP27KGC#Mcardle_2010]

[@FZCRCNQ3#Abbiss_Laursen_2005].

[@8CWGKG2C#Midgley_Mcnaughton_Jones_2007]

[@JN5743YD#Binder_Etal_2008]

jalvesaq commented 5 years ago

The References includes this:

    note: "PMID: 17887811
    arXiv: 1011.1669v3
    Place: New Zealand
    ISBN: 0112-1642; 0112-1642"

The quotation marks opens at note and closes at ISBN.

What actually in the Extra field in Zotero? I have to create a bibliographic entry in my Zotero to replicate the issue.

Zotcite reads the Zotero's database directly. It doesn't run Zotero and doesn't consider any of Zotero's configuration.

olesendan commented 5 years ago

Ah off course. This is exsactly the text string, which is in the Extra field(in the info sidebar) in zotero. This FIeld gets filled with extra information about the reference, when references are imported or merged, every time with a linebreak. This happens quite a lot in my workflow.

I'm quite a newbie in this. So if I don't make sense, It's not to offend anybody.

When zotcite reads the sqlite database, is it possible to skip fields? I'm thinking if it's a sgl query, it have to be hardcoded in every query? or can one simply say NOT note.

Edit: I've just looked in your code. What happens if one simply commenting the "note" out in the python3/zotero.py?

I've never seen this field used in report or papers, so do not think it's important outside zotero

To test this, should I then fork the repo and clone it? what happens if I clone it to my machine, should i then do something different?

/Dan

jalvesaq commented 5 years ago

Please, see line 592 of python3/zotero.py. You could try adding "note" to the dont list. If it works, I can add a variable to zotcite to allow the customization of the dont list.

olesendan commented 5 years ago

Hi Jalvesaq. I will try your advise. I've never tried to change other peoples code, so I do need a bit of guiding, regarding best practise.

Should I fork your repo, then install the forked repo, or make an branch in your repo, and then change the code there? I've never tried to install another branch than the master?

Greetings Dan Olesen

jalvesaq commented 5 years ago

You could just change the code in the vim-plug repository (if you use vim-plug) and tell me if it fixes the issue. If it works, I will create the variable. Then, you could delete the directory and clone it again.

olesendan commented 5 years ago

Hi Jalvesaq.

Thank you, for your advise.

I've changed the code, and done the first test on a minimal doc. It worked. I will try some more testing tonight, will let you know how it vent tomorrow.

/Dan

olesendan commented 4 years ago

Hi Jalvesaq.

I've now been running zotcite with "note" in the note list for two weeks. I've not experienced any problems during af bunch of knittings.

Greetings From Denmark Dan Olesen

jalvesaq commented 4 years ago

Thanks for the feedback! I added the environment variable $Zotcite_exclude which is documented in the README.