1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-28 04:19:56 +00:00
TiddlyWiki5/js/macros/info.js
Jeremy Ruston e2a0955ced Renamed 'handler' member of macros
Used to be called "code". And associated documentation changes
2012-01-15 12:16:28 +00:00

34 lines
619 B
JavaScript

/*\
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: {
},
handler: function(type,tiddler,store,params) {
var encoder = type === "text/html" ? utils.htmlEncode : function(x) {return x;},
parseTree = store.parseTiddler(tiddler.fields.title);
if(parseTree) {
var d = parseTree.dependencies;
if(d === null) {
return encoder("Dependencies: *");
} else {
return encoder("Dependencies: " + d.join(", "));
}
} else {
return "";
}
}
};
})();