citation-file-format/ruby-cff

Removing month also removes year from the output of article

h4iku opened this issue · 4 comments

h4iku commented

Removing month from the preferred-citation part for @article removes year from the output as well.

For example:

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Lisa"
  given-names: "Mona"
title: "My Research Software"
preferred-citation:
  type: article
  authors:
  - family-names: "Lisa"
    given-names: "Mona"
  journal: "Journal Title"
  title: "My awesome research software"
  year: 2021

returns:

@article{Lisa_My_awesome_research,
author = {Lisa, Mona},
journal = {Journal Title},
title = {{My awesome research software}}
}
Lisa, M. My awesome research software. Journal Title

While adding month will also give you year:

@article{Lisa_My_awesome_research_2021,
author = {Lisa, Mona},
journal = {Journal Title},
month = {9},
title = {{My awesome research software}},
year = {2021}
}
Lisa, M. (2021). My awesome research software. Journal Title

Thanks for spotting this @h4iku. I think I see the failing logic in the date parsing code:

  1. We first look for month and year fields, as you are using above.
  2. But if either are empty we try to get the month and year from the date-released field instead.

In your case you're not specifying date-released - which is fair enough - so we need to tighten this logic up.

Actually, @sdruskat and @jspaaks, I wonder if there's any prioritisation I should apply to using dates from references? We have, I think, date-released, date-published and month and year as possible options - what order should we prioritise these in if multiple of them are specified?

For now I have simply fixed the formatter outputs to use a year if one is present - regardless of whether there is a month - and fall back on date-released if there is no year.

We still need to discuss date-released/date-published though 😬

#78 (comment) Good question, I think it's a similar problem as with having multiple dois (in particular doi and identifiers[i].doi). For those, we have landed on writing down the expected behavior somewhere (as "heuristics") such that the users' experience across tools is as consistent as possible. See citation-file-format/citation-file-format#330.

The heuristics would also include behavior for different versions of the spec btw, for example 1.0.3 doesn't have identifiers yet