Page MenuHomePhabricator

Add Citoid support to RefToolbar gadget
Closed, ResolvedPublic3 Estimated Story Points

Description

Since T94223 is probably going to be declined, we should consider more short-term solutions. (The long-term solution is theoretically T104479).

It should be relatively easy to add Citoid support to the RefToolbar gadget. It already supports look-ups for other parameters like DOI and PMID. We should just switch it to use the Citoid public API and add a URL lookup as well.

https://en.wikipedia.org/wiki/Wikipedia:RefToolbar
https://www.mediawiki.org/wiki/Citoid

The code for the RefToolbar lookup API resides at https://github.com/alexz-enwp/reftoolbar/blob/master/lookup.php.

Event Timeline

kaldari raised the priority of this task from to Needs Triage.
kaldari updated the task description. (Show Details)
kaldari added a project: Community-Tech.
kaldari subscribed.
kaldari set Security to None.

It looks like the output of the Citoid API varies considerably depending on what type of URL is used. For example, if the URL is for a book chapter (http://link.springer.com/chapter/10.1007/11926078_68) it will return the chapter title as "title" and the book title as "bookTitle", but if the URL is for a book (https://books.google.com/books?id=k-XBMNVRfw4C), it will return the book title as "title". So we'll need to be careful to look at the itemType before deciding how to map the values.

FWIW, it seems that Mr.Z-Man (Alex) has possibly retired from Wikipedia. He hasn't edited any projects or touched any of his tools in GitHub for the past couple months. If someone wanted to work on this, they might have to folk the code.

kaldari claimed this task.

Went ahead and did this over the weekend.

DannyH edited a custom field.
DannyH edited a custom field.

In the editor, I lookup a DOI and get no result (10.1109/ase.2011.6100176)

In the console, I see that the AJAX Call is made to reftoolbar, and it returns nothing:
https://tools.wmflabs.org/reftoolbar/lookup.php?doi=10.1109%2FASE.2011.6100176&template=journal&format=ref

On the contrary, a call to the citation API would return the correct result:
https://en.wikipedia.org/api/rest_v1/data/citation/zotero/10.1109%2fASE.2011.6100076

How to use the right URL is the editor gadget?

I believe you have to use the "URL" field for citoid results in reftoolbar.
I'm not sure who is running the reftoolbar labs instance but maybe it's
broken. Putting the doi in the URL field should work for the time being.

Probably there should be a separate bug filed for the doi field issue.

Thanks for your answer. We make progress.

There is a difference depending on the editor:

Yet, it does not work in the Visual Editor, because of an encoding problem, see T207518

RefToolbar queries Citoid only for ISBN and URL queries, see https://github.com/alexz-enwp/reftoolbar/blob/master/lookup.php#L328

This pull-request proposes that RefToolbar also uses Citoid for DOI calls: https://github.com/alexz-enwp/reftoolbar/pull/1

Yes, you have to put the DOI in the URL field if you want a response from
citoid - a bit confusing. Plausibly we should enable citoid for the DOI
field as well.