## Monday, September 01, 2008

### Ubiquity fun: resolving DOIs

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",
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>';