emacsorphanage / ox-pandoc

Another org-mode exporter via pandoc.
GNU General Public License v2.0
48 stars 13 forks source link

CITE_EXPORT and BIBLIOGRAPHY Ignored by Ox-pandoc? #39

Closed oncomouse closed 4 months ago

oncomouse commented 6 months ago

I'm trying to export an org file to docx using pandoc, and it looks like ox-pandoc is ignoring CITE_EXPORT and BIBLIOGRAPHY headers in my org files.

I have the following sample bibtex file:

@book{zylinska_minimal_2014,
  title = {Minimal {{Ethics}} for the {{Anthropocene}}},
  author = {Zylinska, Joanna},
  year = {2014},
  month = sep,
  publisher = {Open Humanities},
  address = {Ann Arbor, MI},
  isbn = {978-1-60785-329-9},
  langid = {english}
}

CSL files are installed in ~/.csl.

The following file produces proper citations when I use org-html-export-as-html (including footnotes and bibliography entries):

#+CITE_EXPORT: csl ~/.csl/chicago-note-bibliography.csl
#+BIBLIOGRAPHY: test.bib

[cite:@zylinska_minimal_2014, p. 56]

#+print_bibliography:

However, the above file does not work when I use org-pandoc-export-to-docx. Instead, I just see [cite:@zylinska_minimal_2014, p. 56] in the body of the Word document.

This second org file does produce a docx file with properly formatted citations when using org-pandoc-export-to-docx:

#+PANDOC_OPTIONS: csl:~/.csl/chicago-note-bibliography.csl
#+PANDOC_OPTIONS: bibliography:test.bib
#+PANDOC_OPTIONS: citeproc:t standalone:t

[cite:@zylinska_minimal_2014, p. 56]

#+print_bibliography:

I'd prefer to not rely on pandoc for adding citations (I occasionally need to export to HTML, for instance). It seems like something in ox-pandoc on my system is bypassing handling CITE_EXPORT as an option, but I'm not sure how to proceed with figuring out what it is.

Thanks!

oncomouse commented 6 months ago

So, I've done some more digging with this and it looks like it was because I was using straight to load org-mode from github. Switching to the version of org that's built-in to Emacs 29.3, everything works. Switching to org-mode 9.7 with straight causes the problem. I'm having trouble figuring out where in the org commit history this problem was introduced, however.

yantar92 commented 5 months ago

oncomouse @.***> writes:

... Switching to org-mode 9.7 with straight causes the problem. I'm having trouble figuring out where in the org commit history this problem was introduced, however.

Org 9.7 introduced a breaking change in org->org exporter that we use to pre-process Org file before passing it to pandoc.

Before Org 9.7, citations were unconditionally expanded. In Org 9.7, they are left as is.

I pushed a tentative fix to fix/39 branch. May you try it?

-- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92

oncomouse commented 4 months ago

Sorry it took me so long to get back. The fix works!