mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 20:10:03 +00:00
Switched the macros to use the new HTML class
This commit is contained in:
parent
26c7177752
commit
7ac85ebbbb
@ -7,7 +7,8 @@ title: js/macros/image.js
|
||||
/*jslint node: true */
|
||||
"use strict";
|
||||
|
||||
var utils = require("../Utils.js");
|
||||
var HTML = require("../HTML.js").HTML,
|
||||
utils = require("../Utils.js");
|
||||
|
||||
exports.macro = {
|
||||
name: "image",
|
||||
@ -21,23 +22,21 @@ exports.macro = {
|
||||
if(type === "text/html") {
|
||||
if(store.tiddlerExists(params.src)) {
|
||||
if(params.text) {
|
||||
return utils.stitchElement("div",{
|
||||
alt: params.text,
|
||||
title: params.text
|
||||
},{
|
||||
content: store.renderTiddler(type,params.src)
|
||||
});
|
||||
return HTML(HTML.elem("div",{
|
||||
alt: params.text,
|
||||
title: params.text
|
||||
},[
|
||||
HTML.raw(store.renderTiddler(type,params.src))
|
||||
]));
|
||||
} else {
|
||||
return store.renderTiddler(type,params.src);
|
||||
}
|
||||
} else {
|
||||
return utils.stitchElement("img",{
|
||||
return HTML(HTML.elem("img",{
|
||||
href: params.src,
|
||||
alt: params.text,
|
||||
title: params.text
|
||||
},{
|
||||
selfClosing: true
|
||||
});
|
||||
}));
|
||||
}
|
||||
} else if (type === "text/plain") {
|
||||
return params.text ? params.text : "";
|
||||
|
@ -7,7 +7,8 @@ title: js/macros/info.js
|
||||
/*jslint node: true */
|
||||
"use strict";
|
||||
|
||||
var utils = require("../Utils.js");
|
||||
var HTML = require("../HTML.js").HTML,
|
||||
utils = require("../Utils.js");
|
||||
|
||||
exports.macro = {
|
||||
name: "info",
|
||||
@ -30,22 +31,22 @@ exports.macro = {
|
||||
var parseTree = store.parseTiddler(tiddler.title);
|
||||
switch(info) {
|
||||
case "parsetree":
|
||||
return utils.stitchSlider(type,
|
||||
return HTML(HTML.slider(type,
|
||||
"Parse tree",
|
||||
"The parse tree for this tiddler",
|
||||
parseTree.toString(type));
|
||||
parseTree.toString(type)),type);
|
||||
//break;
|
||||
case "compiled":
|
||||
return utils.stitchSlider(type,
|
||||
return HTML(HTML.slider(type,
|
||||
"Render functions",
|
||||
"The render functions for this tiddler",
|
||||
parseTree.compile(type).toString(type));
|
||||
parseTree.compile(type).toString(type)),type);
|
||||
//break;
|
||||
case "dependencies":
|
||||
return utils.stitchSlider(type,
|
||||
return HTML(HTML.slider(type,
|
||||
"Dependencies",
|
||||
"The dependencies for this tiddler",
|
||||
(parseTree.dependencies === null) ? "*" : encoder(parseTree.dependencies.join(", ")));
|
||||
(parseTree.dependencies === null) ? "*" : encoder(parseTree.dependencies.join(", "))),type);
|
||||
//break;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,8 @@ title: js/macros/link.js
|
||||
/*jslint node: true, browser: true */
|
||||
"use strict";
|
||||
|
||||
var utils = require("../Utils.js");
|
||||
var HTML = require("../HTML.js").HTML,
|
||||
utils = require("../Utils.js");
|
||||
|
||||
exports.macro = {
|
||||
name: "link",
|
||||
@ -27,16 +28,14 @@ exports.macro = {
|
||||
}
|
||||
},
|
||||
render: function(type,tiddler,store,params,content) {
|
||||
if(type === "text/html") {
|
||||
return utils.stitchElement("a",{
|
||||
href: params.target
|
||||
},{
|
||||
content: content,
|
||||
classes: store.adjustClassesForLink([],params.target)
|
||||
});
|
||||
} else if (type === "text/plain") {
|
||||
return content;
|
||||
}
|
||||
return HTML(HTML.elem(
|
||||
"a",{
|
||||
href: params.target,
|
||||
"class": store.adjustClassesForLink([],params.target)
|
||||
},[
|
||||
HTML.raw(content)
|
||||
]
|
||||
),type);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user