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

Field value ignored with using "raw" date type with CSL-YAML #53

Closed
mjfs opened this issue Feb 10, 2021 · 4 comments
Closed

Field value ignored with using "raw" date type with CSL-YAML #53

mjfs opened this issue Feb 10, 2021 · 4 comments

Comments

@mjfs
Copy link

mjfs commented Feb 10, 2021

When using CSL-YAML the following record with date field works as expected:

---
references:
- id: agenda
  title: "Meeting agenda"
  author:
  - literal: "Institution XYZ"
  issued: [[2020,2,11]]
...

However, when trying to use a "raw" date format, the value of "issued" segment is ignored:

---
references:
- id: agenda
  title: "Meeting agenda"
  author:
  - literal: "Institution XYZ"
  issued:
  - raw: "2020-2-11"
...

If my understanding is correct the case above should work in the same way as it does in CSL-JSON, e.g.:

"issued": {
     "raw": "2020-2-11"
}
@jgm
Copy link
Owner

jgm commented Feb 11, 2021

This works properly with the citeproc library:

{"references":
[
  {
    "author": [
      {
        "literal": "Institution XYZ"
      }
    ],
    "id": "agenda",
    "issued": {
      "raw": "2020-02-11"
    },
    "title": "Meeting agenda",
    "type": "book"
  }
]}

(Note: I had to add a leading 0 in "2020-02-11" or it didn't work; that's a small issue we could look into.)

The problem, then, seems to lie not in this library but in the conversion of pandoc metadata references to CSL references.

% pandoc -f markdown -t csljson -s
---
references:
- id: agenda
  title: "Meeting agenda"
  author:
  - literal: "Institution XYZ"
  issued:
  - raw: "2020-2-11"
...
[D
  {
    "author": [
      {
        "literal": "Institution XYZ"
      }
    ],
    "id": "agenda",
    "issued": {
      "date-parts": []
    },
    "title": "Meeting agenda",
    "type": ""
  }
]

@jgm
Copy link
Owner

jgm commented Feb 11, 2021

According to the CSL JSON documentation, it should be

issued:
  raw: "2020-2-11"

(Not in a list.) Correct?

@mjfs
Copy link
Author

mjfs commented Feb 11, 2021

Yes, I believe that you are correct. The example from the documentation of CSL-JSON uses propery/string combination for issued/raw segment. This is apparently also the case with schemas in CSL repository.

@jgm
Copy link
Owner

jgm commented Feb 11, 2021

I think the single-digit month isn't allowed in EDTF. Ignoring that issue, the commit above should fix this.

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