mystmd icon indicating copy to clipboard operation
mystmd copied to clipboard

DOI parsing bug for citations of the same author and year

Open gvarnavi opened this issue 9 months ago • 2 comments
trafficstars

Description

The following citation

[@10.1107/S0567739469001045; @10.1107/S0567739469001057]

seems to break the DOI linker -- resulting in a duplicate citation:

Image

Note the two dois resolve properly using the tool at the bottom of https://www.doi.org/

Additional notes

Contacted @rowanc1 re: this, was prompted to open issue for tracking.

gvarnavi avatar Feb 05 '25 04:02 gvarnavi

Thank you @gvarnavi, we will look into it!

rowanc1 avatar Feb 05 '25 04:02 rowanc1

I may not have time to get to this before the rest of the team does, but I did the up-front digging.

In https://github.com/jupyter-book/mystmd/blob/3186be7ebe7ac3b5c398eee36d0737b8afc3c0fe/packages/myst-cli/src/transforms/citations.ts#L20-L27 we are keying the references object by label, but the label that is populated from our DOI transforms is directly taken from the DOI resolution i.e. is not guaranteed to be unique.

Then, our site theme uses the label to pull-in the resolved citation data: https://github.com/jupyter-book/myst-theme/blob/dcd1c7bb7bdeefcbf6e474334d021076a59867ec/packages/myst-to-react/src/cite.tsx#L54

It seems to me that we should want our labels to be unique, and there's no need for them to be "small" when they're coming from DOIs. So, unless we consider it a feature to be able to do e.g.

See @10.1107/S0567739469001045, i.e. @Hoppe_1969

we could/should just use the identifier (DOI itself) as the label.

agoose77 avatar Feb 05 '25 09:02 agoose77