greenelab / covid19-review

A collaborative review of the emerging COVID-19 literature. Join the chat here:
https://gitter.im/covid19-review/community
Other
116 stars 81 forks source link

Add scite to reference list #791

Closed cgreene closed 3 years ago

cgreene commented 3 years ago

Is your feature request related to a problem? Please describe.

It would be nifty to, at a glance, see how papers that we cite are described in the literature.

Describe the solution you'd like

We could use a scite badge to add a summary for each reference https://scite.ai/badge

Describe alternatives you've considered

I asked the scite folks to support manubot reference lists, but this is not currently on their roadmap.

Additional context Add any other context or screenshots about the feature request here.

cgreene commented 3 years ago

Maybe @vincerubinetti knows a quick way to do this.

vincerubinetti commented 3 years ago

This should be pretty easy.

Here's the code they give:

<link rel="stylesheet" type="text/css" href="https://cdn.scite.ai/badge/scite-badge-latest.min.css">
<script async type="application/javascript" src="https://cdn.scite.ai/badge/scite-badge-latest.min.js"></script>
<div class="scite-badge" data-doi="10.1016/j.biopsych.2005.08.012"/>

The first two lines (I would assume and hope) only need to be included on the page once, then you just put a copy of the third line anywhere you have a new paper.

This can be done in 2 distinct ways, off the top of my head:

1) Write a small Javascript plugin to find all of the bibliography entries at the end of the page, find/extract the doi from the citation, and insert the scite badge with the doi.

2) Use the pandoc/jinja/csl templating in Manubot to simply add the scite badge to every bibliography entry and populate it with the doi.

I can do 1) very quickly. @dhimmel could probably do 2) very quickly. If you only want to do this for this paper, I'd go with 1). If you think it's useful for this to be built into Manubot, you might take the effort to figure out 2) and possibly incorp that solution into rootstock.

cgreene commented 3 years ago

I did take a look at the CSL approach and I wasn't entirely sure what to do there. I was a bit worried that it'd get embedded in the PDF too that way. If we could do it via jinja, I'd be more confident in my ability to do it.

One thing I do kind of like about approach 1 is that if there was no network connection, presumably the scite include also wouldn't work so it might be possible to fail quite gracefully. Otherwise we should see what page performance + look and feel is like if there's no network connection.

dhimmel commented 3 years ago

If we could do it via jinja, I'd be more confident in my ability to do it.

Jinja templating executes prior to when the bibliography has been rendered by pandoc. Therefore, I don't think Jinja is the right approach.

I think 1 is the best approach. You could scan the references to see which ones have a DOI URL, and if they have a DOI add the scite badge.

Another option would be to modify the CSL style to produce special output if the bibliography has a DOI. But since the badge is only for HTML outputs, I think the CSL style is the wrong place. A javascript plugin seems like the right place to start. Would probably even make sense in rootstock (disabled by default).

vincerubinetti commented 3 years ago

scite.zip

Here's the plugin. Put scite.html in the /plugins folder, add the contents of default.html to the end of default.html in the /themes folder. Then modify your build.sh to include the scite.html plugin.

Also add a blank line for consistency in the default.html in between the comments and the style.