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

Custom Field in CSLJson silently dropped #137

Open
AliaumeL opened this issue Oct 10, 2023 · 1 comment
Open

Custom Field in CSLJson silently dropped #137

AliaumeL opened this issue Oct 10, 2023 · 1 comment

Comments

@AliaumeL
Copy link

Expected behavior

Given a valid CSLJson file such as the one below, the custom field custom-field should be parsed and included in the bibliographic entries.

 [
  {
    "id": "citation_id",
    "type": "manuscript",
    "custom": {
      "custom-field": "custom-value"
    }
  }
]

The issue came to my attention when using pandoc to create a (custom) list of bibliographic entries for a curriculum vitae, where extra fields represent additional material (slides, preprint, arxiv version). It is currently not possible, because extra fields are ignored by citeproc. It may be that keeping this information together with the bibliography and feeding it to pandoc is not the correct way to generate this list. Nevertheless, this behavior does not comply with the CSLJson specification.

Futher explanation

The CSLJson schema includes a specific field named custom to allow users to add extra information to bibliographic entries. This is specified on line 444 of the csl-data schema, where the following is written

     "custom": {
        "title": "Custom key-value pairs.",
        "type": "object",
        "description": "Used to store additional information that does not have a designated CSL JSON field. The custom field is preferred over the note field for storing custom data, particularly for storing key-value pairs, as the note field is used for user annotations in annotated bibliography styles.",
        "examples": [
          {
            "short_id": "xyz",
            "other-ids": ["alternative-id"]
          },
          {
            "metadata-double-checked": true
          }
        ]
      }

However, such fields are silently ignored by citeproc, because of line 902 of Types.hs, where the conversion from Json ignores "unknown" field types that are neither strings nor numbers. The issue can be traced back to the definition of allowed field types that does not include dictionaries.

Potential solution

I have no idea how to solve this issue, but it may be that documenting the fact that "custom" fields are ignored is enough to close it.

@jgm
Copy link
Owner

jgm commented Oct 10, 2023

How are these custom fields supposed to be used? Is it possible to access their content in a CSL style? If not, what did you expect pandoc to do with them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants