This is an archived static version of the original discussion site.

Oneboxes for PubMed


It would be so neat if we could have those little previews for PubMed papers.

They are called “oneboxes” and the code for making them is here.


OK, I’ve made some good progress on this.

First of all, a onebox is something like this:

It’s a lovely little formatted box that you automatically get when you paste in a github commit (analogous for some other sites).

I have forked the onebox repository here and made a pubmed onebox. That should be the hard part. Now, what do we want to have it show? Here’s what it generates so far:

<aside class="onebox pubmed">
  <header class="source">
    <a href="">
  <article class="onebox-body">
  <a href="" target="_blank">Evolutionary trees from DNA sequences: a maximum likelihood approach.</a>

<i>Journal of molecular evolution</i>, 1981

The application of maximum likelihood techniques to the estimation of evolutionary trees from nucleic acid sequence data is discussed. A computationally feasible method for finding such maximum likelihood estimates is developed, and a computer program is available. This method has advantages over the traditional parsimony algorithms, which can give misleading results if rates of evolution differ in different lineages. It also allows the testing of hypotheses about the constancy of evolutionary rates by likelihood ratio tests, and gives rough indication of the error of ;the estimate of the tree.

  <div style='clear: both'></div>

You people who know HTML-- help! Also, rubyists (ahem @metasoarous, @trvrb), I’d love some feedback on my code.


It looks like typically the header tag would go inside article (see w3schools) but it probably renders fine either way. Might want to put the abstract in a p tag and “Felsenstein …” in a container (p? h5?) as well.

Yer ruby is looking fine as far as I can tell. Mostly in the corresponding engine and spec as far as I can tell yeah? Also, good job rocking the mustache…


I don’t actually generate this bit!

I’m with you on the <p> for the abstract. However, what makes me sad about the current state of the HTML output is that it doesn’t put the title and author in closely spaced lines like in the GH commit example I put in above, and adding a <p> will only space it out more. What’s a better alternative? A <ul> without bullets?


It looks like they’re using divs for separation in the github example, so if you follow suit the stylesheets might pick up on that for you without any work. If not, you could try adding some custom div (or other container) classes, and tweak the stylesheets a bit to take advanatage of that. You might also try putting both in the same p tag, with a br/ separating them.


Pull request merged, thanks to some key help from @metasoarous.

Will be available once the upgrade cycle goes through, or when I work through issues concerning bundler to do a more direct modification.


This now works with the upgrade. Pasting in