2012-01-07 17:33:42 +00:00
|
|
|
/*\
|
|
|
|
title: js/macros/info.js
|
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true */
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var utils = require("../Utils.js");
|
|
|
|
|
|
|
|
exports.macro = {
|
|
|
|
name: "info",
|
|
|
|
types: ["text/html","text/plain"],
|
|
|
|
params: {
|
|
|
|
},
|
2012-01-15 12:16:28 +00:00
|
|
|
handler: function(type,tiddler,store,params) {
|
2012-01-07 17:33:42 +00:00
|
|
|
var encoder = type === "text/html" ? utils.htmlEncode : function(x) {return x;},
|
2012-01-17 13:01:55 +00:00
|
|
|
parseTree = store.parseTiddler(tiddler.title);
|
2012-01-07 17:33:42 +00:00
|
|
|
if(parseTree) {
|
2012-01-15 18:39:14 +00:00
|
|
|
var r = [];
|
2012-01-07 17:33:42 +00:00
|
|
|
var d = parseTree.dependencies;
|
|
|
|
if(d === null) {
|
2012-01-15 18:39:14 +00:00
|
|
|
r.push(encoder("Dependencies: *"));
|
2012-01-07 17:33:42 +00:00
|
|
|
} else {
|
2012-01-15 18:39:14 +00:00
|
|
|
r.push(encoder("Dependencies: " + d.join(", ")));
|
2012-01-07 17:33:42 +00:00
|
|
|
}
|
2012-01-15 18:39:14 +00:00
|
|
|
return r.join("/n");
|
2012-01-07 17:33:42 +00:00
|
|
|
} else {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|