1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-15 08:24:22 +00:00
TiddlyWiki5/js/macros/info.js
Jeremy Ruston b898afe3e5 Refactor the Tiddler object to enforce immutability
And in the process move the fields out of the fields member
2012-01-17 13:01:55 +00:00

36 lines
653 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.title);
if(parseTree) {
var r = [];
var d = parseTree.dependencies;
if(d === null) {
r.push(encoder("Dependencies: *"));
} else {
r.push(encoder("Dependencies: " + d.join(", ")));
}
return r.join("/n");
} else {
return "";
}
}
};
})();