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
28 lines
423 B
JavaScript
28 lines
423 B
JavaScript
/*\
|
|
title: js/macros/echo.js
|
|
|
|
\*/
|
|
(function(){
|
|
|
|
/*jslint node: true */
|
|
"use strict";
|
|
|
|
var utils = require("../Utils.js");
|
|
|
|
exports.macro = {
|
|
name: "echo",
|
|
types: ["text/html","text/plain"],
|
|
params: {
|
|
text: {byPos: 0, type: "text", optional: false}
|
|
},
|
|
code: function(type,tiddler,store,params) {
|
|
if(type === "text/html") {
|
|
return utils.htmlEncode(params.text);
|
|
} else {
|
|
return params.text;
|
|
}
|
|
}
|
|
};
|
|
|
|
})();
|