2012-01-15 13:29:16 +00:00
|
|
|
/*\
|
|
|
|
title: js/macros/link.js
|
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true */
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var utils = require("../Utils.js");
|
|
|
|
|
|
|
|
exports.macro = {
|
|
|
|
name: "link",
|
|
|
|
wrapperTag: "span",
|
|
|
|
types: ["text/html","text/plain"],
|
|
|
|
params: {
|
2012-01-15 18:39:14 +00:00
|
|
|
target: {byName: "default", type: "tiddler", optional: false}
|
2012-01-15 13:29:16 +00:00
|
|
|
},
|
2012-01-15 18:39:14 +00:00
|
|
|
handler: function(type,tiddler,store,params,content) {
|
2012-01-15 13:29:16 +00:00
|
|
|
if(type === "text/html") {
|
|
|
|
return utils.stitchElement("a",{
|
|
|
|
href: params.target
|
|
|
|
},{
|
2012-01-15 18:39:14 +00:00
|
|
|
content: content,
|
2012-01-15 13:29:16 +00:00
|
|
|
classNames: store.adjustClassesForLink([],params.target)
|
|
|
|
});
|
|
|
|
} else if (type === "text/plain") {
|
2012-01-16 08:58:51 +00:00
|
|
|
return content;
|
2012-01-15 13:29:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|