mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-09-11 23:09:42 +00:00
![Jeremy Ruston](/assets/img/avatar_default.png)
Now each macro is in a separate file, and is implemented as a function, rather than being inlined into the compiled tiddler rendering function
34 lines
616 B
JavaScript
34 lines
616 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: {
|
|
},
|
|
code: 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 "";
|
|
}
|
|
}
|
|
};
|
|
|
|
})();
|