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
It seems like you want to do something like chaining commands? if so, this is useful
ReplyDeletehttp://foyrek.com/chain.html
Good to meet you at SciBlog2008 Egon..they're already labelling next year's event ScienceOnline2009...anyway...
ReplyDelete...could you tie this script into researchblogging.org so that rather than simply resolving the DOI it also gave users the citation code to add to a blog post about the paper in question?
@Rajarshi: I'll check that...
ReplyDelete@David: great to meet you too! Yeah, saw it. Website was still empty, never too late to grab a domain :)
Yes, that's basically the same thing... someone did mention that the script does not work for NN, because that does not use HTML for link markup... similarly, for wiki's the markup would look differently... but yes, generally, that should work fine.