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