kaushalmodi / ox-hugo

A carefully crafted Org exporter back-end for Hugo
https://ox-hugo.scripter.co
GNU General Public License v3.0
874 stars 132 forks source link

Exporting citations with pandoc does not work when exporting an entire file #663

Closed thibautbenjamin closed 2 years ago

thibautbenjamin commented 2 years ago

Actual Behavior

When trying to export a file as a single page, the pandoc citations are completely ignored and treated as normal text. I think pandoc does not even run and no references are printed.

Expected Behavior

The references are correctly analyzed by pandoc and printed

How to Reproduce the Issue

Export a file with pandoc citations as a single page and see the absence of citations.

Example Org File

When I try to export the following file:

title: Bibliography
#+hugo_base_dir: ../
#+EXPORT_FILE_NAME: citations-example
#+EXPORT_HUGO_PANDOC_CITATIONS: t
#+EXPORT_BIBLIOGRAPHY: biblio.bib

* Interesting topic
** Papers
a good paper (@cite1)

The citation is completely ignored and treated as if it was normal text. I believe that pandoc is not even called

Interestingly, moving the properties to a drawer like so

title: Bibliography
#+hugo_base_dir: ../
#+EXPORT_FILE_NAME: citations-example

* Interesting topic
:PROPERTIES:
:EXPORT_HUGO_PANDOC_CITATIONS: t
:EXPORT_BIBLIOGRAPHY: higher-category.bib
:END:

** Papers
a good paper (@cite1)

seems to make the export take the citations in account. It also seems to really confuse the the exporter into adding the metadata twice, which does not render very well.

Generated Markdown File or Error

Ox-Hugo Debug Information

Debug Info
kaushalmodi commented 2 years ago

For most properties, this is the syntax in general:

So the EXPORT_ prefix has to be used only in property drawers.

See its documentation.

thibautbenjamin commented 2 years ago

Thanks a lot, it is working now. I somehow completely missed that. I tried to shortcut learning ox-hugo because I have a website to write. I did not realize that there was a parsing of properties that was specific to this mode

kaushalmodi commented 2 years ago

I did not realize that there was a parsing of properties that was specific to this mode

The EXPORT_ prefix is not specific to ox-hugo. See the Org manual Info node (org) Export Settings:

When exporting sub-trees, special node properties can override the above keywords. These properties have an ‘EXPORT_’ prefix. For example, ‘DATE’ becomes, ‘EXPORTDATE’ when used for a specific sub-tree. Except for ‘SETUPFILE’, all other keywords listed above have an ‘EXPORT’ equivalent.