Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

YAML bibliographies require an object with references and do not accept arrays #10452

Closed
dhimmel opened this issue Dec 11, 2024 · 0 comments
Closed
Labels

Comments

@dhimmel
Copy link

dhimmel commented Dec 11, 2024

migrated from quarto-dev/quarto-cli#11656

Currently, the following bibliography.json file works as intended in a document that cites @osmnx and uses the citeproc filter:

[
    {
        "id": "osmnx",
        "type": "article-journal",
        "title": "OSMnx: New methods for acquiring, constructing, analyzing, and visualizing complex street networks"
    }
]

However, if we convert the JSON to YAML, no references will be loaded from bibliography.yaml:

- id: osmnx
  type: article-journal
  title: 'OSMnx: New methods for acquiring, constructing, analyzing, and visualizing complex street networks'

The workaround is easy, to use a dictionary/object as the top-level of the YAML with a key for references whose values are the array of CSL data references:

references:
- id: osmnx
  type: article-journal
  title: 'OSMnx: New methods for acquiring, constructing, analyzing, and visualizing complex street networks'

Accepting an array of references via YAML would make sense because

  • for parity with the JSON handling
  • since the official CSL Data spec specifies an array
  • it used to work in older versions of pandoc (if I'm not mistaken)

Noting extra context provided by @jgm at quarto-dev/quarto-cli#11656 (comment):

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.

@dhimmel dhimmel added the bug label Dec 11, 2024
@jgm jgm closed this as completed in d04e490 Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant