Published September 1, 2008 | https://doi.org/10.59350/gfjz7-ykc12

Ubiquity fun: resolving DOIs

Creators & Contributors

Now, I'm really after something else, but here's my first Ubiquity scripts. It allow you to select a DOI on any web page (which really only makes sense if it is not already a hyperlink), you hit ALT-SPACE (Linux), CTRL-SPACE (Windows), or whatever the shortcut is on your operating system, and type resolve-doi and it will automatically convert the DOI into a hyperlink to look up the paper.

What I am actually interested in, is being able to use this command in a blog editing environment; however, I have not managed to get that working in one command. And because I am apparently not able to put in two ubiquity commands in blog items, you need to go to this page.

Second warning. I have only tried them with Ubiquity 0.1, not 0.1.1, or even later.

For the curious, the script looks like:

CmdUtils.CreateCommand({
  name: "resolve-doi",
  homepage: "http://chem-bla-ics.blogspot.com/",
  author: { name: "Egon Willighagen", email: "egon.willighagen@gmail.com"},
  description: "Resolves a DOI into a URL",
  license: "GPL",
  takes: {"doi": noun_arb_text},

  preview: function( pblock, doi ) {
    var msg = 'Inserts a URL for the DOI: ${doi}';
    var d = doi.text || CmdUtils.getSelection();
    pblock.innerHTML = CmdUtils.renderTemplate(msg, {doi: d});
  },

  execute: function( doi ) {
    var msg = '<a href="http://dx.doi.org/${doi}">${doi}</a>';
    var d = doi.text || CmdUtils.getSelection();
    var newText = CmdUtils.renderTemplate(msg, {doi: d});
    CmdUtils.setSelection(newText);
  }
})

Comments on this code most welcome! It's GPL. Details can be found in this tutorial and examples in Rajarshi's blog.

Additional details

Description

Now, I'm really after something else, but here's my first Ubiquity scripts. It allow you to select a DOI on any web page (which really only makes sense if it is not already a hyperlink), you hit ALT-SPACE (Linux), CTRL-SPACE (Windows), or whatever the shortcut is on your operating system, and type resolve-doi and it will automatically convert the DOI into a hyperlink to look up the paper.

Identifiers

UUID
d0c9f770-acf1-4c06-aa41-b2c524ac950f
GUID
https://doi.org/10.59350/gfjz7-ykc12
URL
https://chem-bla-ics.linkedchemistry.info/2008/09/01/ubiquity-fun-resolving-dois.html

Dates

Issued
2008-09-01T00:00:00
Updated
2008-09-01T00:00:00