WDscholia / scholia

Wikidata-based scholarly profiles
https://scholia.toolforge.org
Other
215 stars 78 forks source link

DOI with square brackets is not working in the Scholia search field. #2406

Closed fnielsen closed 5 months ago

fnielsen commented 5 months ago

Describe the bug https://academic.oup.com/bioscience/article/52/1/44/291662 has a "10.1641/0006-3568(2002)052[0044:PTLBTR]2.0.CO;2".

To Reproduce Steps to reproduce the behavior:

  1. Go to https://scholia.toolforge.org/
  2. Click on copy-paste 10.1641/0006-3568(2002)052[0044:PTLBTR]2.0.CO;2 in the search field
  3. "DOI does not exist"

Expected behavior The DOI exists and quickstatements should be generated

larsgw commented 5 months ago

Two issues:

  1. The search page redirects to https://scholia.toolforge.org/doi/10.1641/0006-3568(2002)052, i.e. an incomplete DOI, missing everything after the [.
  2. Going to https://scholia.toolforge.org/doi/10.1641/0006-3568(2002)052[0044:PTLBTR]2.0.CO;2 instead, the DOI is not recognized as such by Citation.js. (This is expected, the DOI recognition pattern does not cover everything or it might be too broad.) However, it is possible to 'force' Citation.js to interpret it as a DOI.

The second can be fixed by changing the following line:

+ let example = new c.Cite([ '{{ doi }}' ], { forceType: '@doi/id' })
- let example = new c.Cite([ '{{ doi }}' ])
fnielsen commented 5 months ago

Would "{ forceType: '@doi/id' }" be too broad?

larsgw commented 5 months ago

On the https://scholia.toolforge.org/doi/... page I think it might be expected that the input is treated as a DOI.

fnielsen commented 5 months ago

@larsgw I get:

TypeError: No synchronous parser found for @else/url
    data http://127.0.0.1:8100/static/js/citation.js:1264
    chain http://127.0.0.1:8100/static/js/citation.js:933
    <anonymous> else/list+object@http://127.0.0.1:8100/static/js/citation.js:1250
    data http://127.0.0.1:8100/static/js/citation.js:1262
    chain http://127.0.0.1:8100/static/js/citation.js:933
    add http://127.0.0.1:8100/static/js/citation.js:201
    set http://127.0.0.1:8100/static/js/citation.js:222
    Cite http://127.0.0.1:8100/static/js/citation.js:116
    <anonymous> http://127.0.0.1:8100/doi/10.1641/0006-3568(2002)052[0044:PTLBTR]2.0.CO;2:391
[0006-3568(2002)052[0044:PTLBTR]2.0.CO;2:406:13](http://127.0.0.1:8100/doi/10.1641/0006-3568(2002)052%5B0044:PTLBTR%5D2.0.CO;2)
larsgw commented 5 months ago

I forgot about that... I'm working on it, sorry.

larsgw commented 5 months ago

I've ended up broadening the DOI pattern in Citation.js anyway, the patch is in the PR.