jgm/citeproc

How to output raw issued date?

Closed this issue · 3 comments

Hey,

I'd like to convert bibtex to csl json, but the date-parts array is not really suitable for me. A simple year field would be the best, but I found outputs in the issues where a "raw issued" entry is available (e.g., #53 ), that might be also okay. How to produce raw date?

Thank you,

The command I use:

pandoc -f bibtex -t csljson publications.bib > publications.json

A sample entry I have:

@article{pinter2022awakening,
  title={Awakening City: Traces of the Circadian Rhythm within the Mobile Phone Network Data},
  author={Pint{\'e}r, Gerg{\H{o}} and Felde, Imre},
  journal={Information},
  volume={13},
  number={3},
  pages={114},
  year={2022},
  publisher={Multidisciplinary Digital Publishing Institute},
  doi={10.3390/info13030114}

And the output I get:

  {
    "DOI": "10.3390/info13030114",
    "author": [
      {
        "family": "Pintér",
        "given": "Gergő"
      },
      {
        "family": "Felde",
        "given": "Imre"
      }
    ],
    "container-title": "Information",
    "id": "pinter2022awakening",
    "issue": "3",
    "issued": {
      "date-parts": [
        [
          2022
        ]
      ]
    },
    "page": "114",
    "publisher": "Multidisciplinary Digital Publishing Institute",
    "title": "Awakening City: Traces of the Circadian Rhythm within the Mobile Phone Network Data",
    "title-short": "Awakening City",
    "type": "article-journal",
    "volume": "13"
  }

Version info:
pandoc 2.18
Compiled with pandoc-types 1.22.2, texmath 0.12.5, skylighting 0.12.3,
citeproc 0.7, ipynb 0.2, hslua 2.2.0
Scripting engine: Lua 5.4

jgm commented

I don't understand. The output you're getting is the correct way to represent a date with just a year in CSL JSON. What is the problem?

The output is perfectly correct, but I don't want to use it as a CSL JSON.
Actually I only need a bibtex to JSON conversion for reading the JSON from a template language. But it is cumbersome to work with this nested array in the template, so I see three options:

  1. use a different converter
  2. write a postprocessing script to transform the date
  3. get this "debug" output with the raw value

Again, what I want is not exactly the intended use case, citeproc works as it should.
However, as I saw outputs with "raw" value I wanted to ask about them, before I fallback to the 2nd option.

jgm commented

No, raw dates are only used for things that can't be parsed as regular dates.