odkr / pandoc-zotxt.lua

Pandoc filter that looks up bibliographic data for citations in Zotero.
MIT License
48 stars 2 forks source link

bibliography "not found in resource path" #10

Closed newhallroad closed 11 months ago

newhallroad commented 11 months ago

Thank you for all your work on this project.

I would appreciate your help using pandoc-zotx.lua to generate output with correct citations.

Here is a basic test case:

---
zotero-bibliography: bib.json
---

Test citation

[@salzman_StrugglesPromisedLand_1997]

I am expecting that if I use pandoc-zotxt.lua then the bibtext key will be looked up in my desktop Zotero instance and added to bib.json. I further expect the filter to add that bibliography to the metadata (based on the manual: "The bibliography file is added to the "bibliography" metadata field automatically") so that the output is a formatted citation.

In fact, what happens is that the lua filter runs and creates bib.json correctly, but does not add it to the metadata as a bibliography file. The result is html output like this:

Test citation

salzman_StrugglesPromisedLand_1997?

If I add bib.json as "bibliography" to the yaml metadata myself, pandoc fails to run because it can't find the bibliography. Pandoc outputs:

File bib.json not found in resource path

Perhaps this is because pandoc tries to run citeproc before the lua filter, so the bib.json file is not yet available.

If I run the command first with the filter but without the bibliography in the metadata, and then add bib.json as bibliography and run it a second time, pandoc then finds bib.json and correctly formats the citation, resulting in the desired output. But running the script twice, and having to add the bibliography before the second time, is not expected behavior, and is quite tedious.

Am I doing something wrong? Many thanks for your advice.

newhallroad commented 11 months ago

My mistake! Your filter works perfectly from the cli. The problem was that I was using pandoc-mode in emacs, which seems to run citeproc before lua filters. I might be mistaken about that also, but I opened an issue just in case. In case anyone is interested, here it is. Thank you.

odkr commented 11 months ago

Hey, sorry, I was sick. But you figured it out on your own :-). And just in case anybody else has a similar issue: Yes, the filter must be run before citeproc.