jalvesaq / zotcite

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

HTML reference-list disappears in Quarto HTML output #55

Closed LibrEars closed 1 year ago

LibrEars commented 1 year ago

Hi again =)

I noticed that by using the zotcite.py filter for quarto my reference list disappears in the HTML output (book project). Single references still show up when hovering over the link in the text with the mouse. I use the quarto version: 1.2.267

yaml to reproduce issue (see quarto books):

project:
  type: book

book:
  title: "mybook"
  author: "Jane Doe"
  date: "8/18/2021"
  chapters:
    - index.qmd
    - intro.qmd
    - summary.qmd
    - references.qmd

bibliography: references.bib
filters:
  - /path/to/zotcite/python3/zotref.py   # exchange with your path to filter

format:
  html:
    theme: cosmo
  pdf:
    documentclass: scrreport
  epub:
    cover-image: cover.png

Then add some reference in e.g. intro.qmd and preview HTML with quarto preview mybook

jalvesaq commented 1 year ago

Thanks for reporting the issue, but I have never worked on a book project with Quarto. So, I would need a complete minimal project to replicate the issue, perhaps a tar.gz or zip with all the required files. I would only replace the references with ones from my Zotero database.

LibrEars commented 1 year ago

thank you for the quick reply. Here is a zip with a skeleton of a book (github does not allow tar.gz):

myproject.zip

jalvesaq commented 1 year ago

It seems that citeproc is running before zotref.py. That is when zotref.py strips the citation keys from its visible part citeproc has already failed to find the citations.

What worked for me was.

  1. Put in _quarto.yaml:
citeproc: false
bibliography:
  - references.bib
  - myproject_zotcite.bib 

Run quarto in the terminal:

quarto render . pandoc-args -F /path/to/zotcite/python3/zotref.py --citeproc

This way we guarantee that pandoc will run zotref.py before citeproc.

jalvesaq commented 1 year ago

Sorry, I was wrong. The citation works, but the reference list does not. Quarto runs zotref.py four times, one for each chapter, and each time myproject_zotcite.bib is overwritten. Because there is no reference the last time (when processing references.qmd) the final bib file is empty and citeproc finds nothing.