Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

YAML bibliographies should accept list format, currently requires a dictionary with references #11656

Closed
dhimmel opened this issue Dec 10, 2024 · 6 comments
Labels
pandoc upstream Bug is in upstream library
Milestone

Comments

@dhimmel
Copy link

dhimmel commented Dec 10, 2024

Define the following two files.

document.qmd:

---
title: "Quarto bibliography.yml references"
bibliography: bibliography.yml
---

Making a citation to citation key `osmnx` [@osmnx].

bibliography.yml:

- id: osmnx
  DOI: 10.1016/j.compenvurbsys.2017.05.004
  type: article-journal
  title: 'OSMnx: New methods for acquiring, constructing, analyzing, and visualizing complex street networks'
  author:
  - given: Geoff
    family: Boeing

Run:

quarto render document.qmd

Note the logged error:

[WARNING] Citeproc: citation osmnx not found

Prepending the following to bibliography.yml solves the issue:

references:

IIRC Pandoc accepts CSL JSON (as JSON or YAML) when formatted a list of dictionaries rather than a top-level dictionary with a references key.

@dhimmel dhimmel added the bug Something isn't working label Dec 10, 2024
@dhimmel
Copy link
Author

dhimmel commented Dec 10, 2024

Example from pandoc's citeproc library showing CSL JSON / citeproc JSON without a top-level references.

Here's the JSON Schema for CSL Data noting:

  "type": "array",
  "items": {
    "type": "object",

@cscheid
Copy link
Collaborator

cscheid commented Dec 10, 2024

I can reproduce this warning with pure Pandoc, so I don't think this is on Quarto:

$ cat issue-11656-pandoc.md
---
bibliography: bib.yml
---

Making a citation to citation key `osmnx` [@osmnx].
$ cat bib.yml
- id: osmnx
  DOI: 10.1016/j.compenvurbsys.2017.05.004
  type: article-journal
  title: 'OSMnx: New methods for acquiring, constructing, analyzing, and visualizing complex street networks'
  author:
  - given: Geoff
    family: Boeing
$ pandoc -f markdown -t html --citeproc issue-11656-pandoc.md
[WARNING] Citeproc: citation osmnx not found
<p>Making a citation to citation key <code>osmnx</code> <span
class="citation"
data-cites="osmnx">(<strong>osmnx?</strong>)</span>.</p>

I'm going to go ahead and close this one, but feel free to reopen it if I've missed something.

@cscheid cscheid closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2024
@cscheid cscheid added pandoc upstream Bug is in upstream library and removed bug Something isn't working bibliography labels Dec 10, 2024
@dhimmel
Copy link
Author

dhimmel commented Dec 10, 2024

Thanks @cscheid for the insight that this occurs in pandoc, which I've confirmed on my original example with:

quarto pandoc --from=markdown --to=html --output=document.html --citeproc document.qmd

Now if I switch the bibliography to JSON like:

[
    {
        "id": "osmnx",
        "DOI": "10.1016/j.compenvurbsys.2017.05.004",
        "type": "article-journal",
        "title": "OSMnx: New methods for acquiring, constructing, analyzing, and visualizing complex street networks",
        "author": [
        {
            "given": "Geoff",
            "family": "Boeing"
        }
        ]
    }
]

there is no problem with citeproc loading the reference metadata.

@jgm looping you in here. Is it intentional that the same bibliographic payload works in JSON but fails in YAML? I don't remember this being the case in the past with pandoc-citeproc.

@jgm
Copy link

jgm commented Dec 11, 2024

Not really intentional, nor unintentional. I reused a function yamlToRefs that is defined in the Markdown reader. This is what the Markdown reader uses to extract references from the metadata, and obviously it needs to look for a references key. This is turn is just a wrapper around yamlBsToRefs (which operates on a bytestring). It would probably be harmless to adjust yamlBsToRefs, which currently just returns an empty list of references if the YAML is not a dictionary/object, to also handle the case where we have an array.

Feel free to open an issue in pandoc.

@dhimmel
Copy link
Author

dhimmel commented Dec 13, 2024

Thanks @cscheid and @jgm. Noting yaml array bibliography support was added upstream in jgm/pandoc@d04e490.

@cscheid
Copy link
Collaborator

cscheid commented Dec 13, 2024

Thanks, @dhimmel - we'll pick this up when the fix shows up in a release.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
pandoc upstream Bug is in upstream library
Projects
None yet
Development

No branches or pull requests

5 participants