typst / hayagriva

Rusty bibliography management.
Apache License 2.0
314 stars 47 forks source link

DOI not available in CSL #110

Closed timon-schelling closed 8 months ago

timon-schelling commented 9 months ago

Description

doi is referenced in the csl file but not printed.

image

section in main.csl

<text variable="DOI" prefix="doi:" suffix=", "/>
<text variable="URL"/>

refs.yaml

bartels2005:
  type: Article
  title: "Homer Gets a Tax Cut: Inequality and Public Policy in the American Mind"
  author: "Bartels, Larry M."
  date: 2005
  publisher: "Perspectives on Politics"
  doi: "10.1017/s1537592705050036"
  url:
    value: "https://doi.org/10.1017/s1537592705050036"
    date: "2023-12-06"
  page-range: 15-31
  volume: 3
  number: 1
  issn: "15375927, 15410986"

csl works with https://editor.citationstyles.org/visualEditor/

image

Reproduction URL

https://typst.app/project/rYTX-2xTFEVZl8eKErcj8O

Operating system

Linux

Typst version

DerDrodt commented 9 months ago

Parsing of DOI in yaml is broken. You can fix your bibliography by using the serial-number field.

@reknih is this intended or should the doi field still exist? I can change de-serialization to handle DOI especially.

(Hayagriva really needs to warn when fields are not read properly)

DerDrodt commented 9 months ago

It seems the docs were just outdated. Use the serial-number field.

(Also the number field you use does not exist -- use issue)

timon-schelling commented 9 months ago

Thx, for the info. What is the name of serial-number in csl? In my opinion doi should be its separate thing.

DerDrodt commented 9 months ago

There is no serial-number in CSL. Hayagriva is it's own format and groups numbers like DOI, ISSN, etc. together.

timon-schelling commented 9 months ago

I mean, what variable name should i use to reference serial-number inside my csl file?

DerDrodt commented 9 months ago

Oh, sorry. Your CSL file is correct as is. Hayagriva is (intended to be) compliant with the CSL files. If you have

bartels2005:
  type: Article
  title: "Homer Gets a Tax Cut: Inequality and Public Policy in the American Mind"
  author: "Bartels, Larry M."
  date: 2005
  publisher: "Perspectives on Politics"
  serial-number:
    doi: "10.1017/s1537592705050036"
    issn: "15375927, 15410986"
  url:
    value: "https://doi.org/10.1017/s1537592705050036"
    date: "2023-12-06"
  page-range: 15-31
  volume: 3
  issue: 1

it will print the correct output. (Note that the issn field should also be moved to serial-number!)

timon-schelling commented 9 months ago

thx, that's surprisingly clean 👍