typst / hayagriva

Rusty bibliography management.
Apache License 2.0
321 stars 48 forks source link

Strange doi presentation with certain bibliography styles #114

Open Enivex opened 10 months ago

Enivex commented 10 months ago

Description

In springer-mathphys, doi are prefaced by https://doi.org/, but that isn't part of the link, which looks weird.

Reproduction URL

No response

Operating system

No response

Typst version

Fabioni commented 10 months ago

Could be related to https://github.com/typst/typst/issues/2853

yochem commented 9 months ago

It seems that Hayagriva just puts in the CSL prefix field for the DOI, which in some cases is https://doi.org/, but in others DOI:. Thus, hayagriva should make either a distinction between the two (test if the prefix itself is a url) or just include the prefix in the hyperlinked text, also for DOI: prefixes.

TimeTravelPenguin commented 1 month ago

I have the same issue. The paper I wanted to cite was https://dl.acm.org/doi/10.5555/1082161.1082202. However, using the style "springer-lecture-notes-in-computer-science", the doi 10.5555/1082161.1082202 rendered result was https://doi.org/10.5555/1082161.1082202, which is an invalid URL. I have never included the https://doi.org prefix, so I have to instead either use url (in my .bib file) or do something else.

I would really like the ability to remove the prefix. It also makes styling very difficult, as mentioned in a duplicate issue https://github.com/typst/typst/issues/2853

harrysw1729 commented 1 month ago

I have the same issue. The paper I wanted to cite was https://dl.acm.org/doi/10.5555/1082161.1082202. However, using the style "springer-lecture-notes-in-computer-science", the doi 10.5555/1082161.1082202 rendered result was https://doi.org/10.5555/1082161.1082202, which is an invalid URL. I have never included the https://doi.org prefix, so I have to instead either use url (in my .bib file) or do something else.

I would really like the ability to remove the prefix. It also makes styling very difficult, as mentioned in a duplicate issue typst/typst#2853

If you only need to remove the prefix, I think there are three quick workarounds.

The first is to use a different CSL that does not prefix https://doi.org to DOIs, e.g., ieee.

The second way is to use a nested show-rule, which replaces the https://doi.org prefix to DOI:.

#show bibliography: it => {
  show "https://doi.org/": "DOI: "
  it
}

The third way is to edit the CSL file directly. For example, you can go to the CSL's official repo to locate the CSL of springer-lecture-notes-in-computer-science and edit it to your liking. The relevant style is here. From the source code, we see that this style prefixes doi with . https://doi.org/. You could copy it and change the prefix to . DOI:, and then use the customized CSL file in Typst.

That being said, removing the prefix won't fix your issue as you have used a non-standard DOI. I believe by default a DOI refers to an identifier resolved by the DOI Foundation, and thus the prefix with https://doi.org/ is expected. Other bibliography management such as LaTeX's biblatex supports DOIs hosted by other archive systems such as those by ACM and ArXiv by processing the fields eprint and eprinttype in your .bib file. Thus, if the standard DOI is not provdied, I think you should probably use the url field instead.