Skip to content

Instantly share code, notes, and snippets.

@sukima
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sukima/11113680 to your computer and use it in GitHub Desktop.
Save sukima/11113680 to your computer and use it in GitHub Desktop.
function Monad(data) { this.data = data; }
Monad.prototype.bind = function(context, functionName) {
return new Monad(context[functionName](this.data));
};
exports.name = 'jira';
exports.params = [{name: 'ticket'}];
exports.run = function(ticket) {
if (!ticket) {
ticket = new Monad('currentTiddler')
.bind(this, 'getVariable')
.bind(this.wiki, 'getTiddler')
.data.getFieldString('ticket');
}
if (!ticket) { return ''; }
var url = 'https://mycompany.atlassian.net/browse/' + ticket;
return '[[' + ticket + '|' + url + ']]';
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment