mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 13:29:56 +00:00
Removed unnecessary type declaration from macros
This commit is contained in:
parent
3633a40986
commit
8847551bd9
@ -11,7 +11,6 @@ var Renderer = require("../Renderer.js").Renderer;
|
|||||||
|
|
||||||
exports.macro = {
|
exports.macro = {
|
||||||
name: "echo",
|
name: "echo",
|
||||||
types: ["text/html","text/plain"],
|
|
||||||
params: {
|
params: {
|
||||||
text: {byPos: 0, type: "text"}
|
text: {byPos: 0, type: "text"}
|
||||||
},
|
},
|
||||||
|
@ -11,7 +11,6 @@ var Renderer = require("../Renderer.js").Renderer;
|
|||||||
|
|
||||||
exports.macro = {
|
exports.macro = {
|
||||||
name: "image",
|
name: "image",
|
||||||
types: ["text/html","text/plain"],
|
|
||||||
params: {
|
params: {
|
||||||
src: {byName: "default", type: "tiddler"},
|
src: {byName: "default", type: "tiddler"},
|
||||||
text: {byName: true, type: "text"},
|
text: {byName: true, type: "text"},
|
||||||
|
@ -16,7 +16,6 @@ var isLinkExternal = function(target) {
|
|||||||
|
|
||||||
exports.macro = {
|
exports.macro = {
|
||||||
name: "link",
|
name: "link",
|
||||||
types: ["text/html","text/plain"],
|
|
||||||
params: {
|
params: {
|
||||||
target: {byName: "default", type: "tiddler", skinny: true}
|
target: {byName: "default", type: "tiddler", skinny: true}
|
||||||
},
|
},
|
||||||
|
@ -34,7 +34,6 @@ var handlers = {
|
|||||||
|
|
||||||
exports.macro = {
|
exports.macro = {
|
||||||
name: "list",
|
name: "list",
|
||||||
types: ["text/html","text/plain"],
|
|
||||||
dependentAll: true, // Tiddlers containing <<list>> macro are dependent on every tiddler
|
dependentAll: true, // Tiddlers containing <<list>> macro are dependent on every tiddler
|
||||||
params: {
|
params: {
|
||||||
type: {byName: "default", type: "text"},
|
type: {byName: "default", type: "text"},
|
||||||
|
@ -32,47 +32,45 @@ var Renderer = require("../Renderer.js").Renderer,
|
|||||||
Tiddler = require("../Tiddler.js").Tiddler,
|
Tiddler = require("../Tiddler.js").Tiddler,
|
||||||
utils = require("../Utils.js");
|
utils = require("../Utils.js");
|
||||||
|
|
||||||
|
function getOpenState(macroNode) {
|
||||||
function getOpenState() {
|
if(macroNode.params.hasOwnProperty("state")) {
|
||||||
if(this.params.hasOwnProperty("state")) {
|
var stateTiddler = macroNode.store.getTiddler(macroNode.params.state);
|
||||||
var stateTiddler = this.store.getTiddler(this.params.state);
|
|
||||||
if(stateTiddler) {
|
if(stateTiddler) {
|
||||||
return stateTiddler.text.trim() === "open";
|
return stateTiddler.text.trim() === "open";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.params.hasOwnProperty("default")) {
|
if(macroNode.params.hasOwnProperty("default")) {
|
||||||
return this.params["default"] === "open";
|
return macroNode.params["default"] === "open";
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
|
||||||
function saveOpenState() {
|
function saveOpenState(macroNode) {
|
||||||
if(this.params.hasOwnProperty("state")) {
|
if(macroNode.params.hasOwnProperty("state")) {
|
||||||
var stateTiddler = this.store.getTiddler(this.params.state) ||
|
var stateTiddler = macroNode.store.getTiddler(macroNode.params.state) ||
|
||||||
new Tiddler({title: this.params.state, text: ""});
|
new Tiddler({title: macroNode.params.state, text: ""});
|
||||||
this.store.addTiddler(new Tiddler(stateTiddler,{text: this.isOpen ? "open" : "closed"}));
|
macroNode.store.addTiddler(new Tiddler(stateTiddler,{text: macroNode.isOpen ? "open" : "closed"}));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSliderContent() {
|
function getSliderContent(macroNode) {
|
||||||
if(this.params.hasOwnProperty("content")) {
|
if(macroNode.params.hasOwnProperty("content")) {
|
||||||
return this.store.parseText("text/x-tiddlywiki",this.params.content).nodes;
|
return macroNode.store.parseText("text/x-tiddlywiki",macroNode.params.content).nodes;
|
||||||
} else if(this.params.hasOwnProperty("target")) {
|
} else if(macroNode.params.hasOwnProperty("target")) {
|
||||||
return [Renderer.MacroNode(
|
return [Renderer.MacroNode(
|
||||||
"tiddler",
|
"tiddler",
|
||||||
{target: this.params.target},
|
{target: macroNode.params.target},
|
||||||
null,
|
null,
|
||||||
this.store)];
|
macroNode.store)];
|
||||||
} else {
|
} else {
|
||||||
return [Renderer.ErrorNode("No content specified for slider")];
|
return [Renderer.ErrorNode("No content specified for slider")];
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
exports.macro = {
|
exports.macro = {
|
||||||
name: "slider",
|
name: "slider",
|
||||||
types: ["text/html","text/plain"],
|
|
||||||
params: {
|
params: {
|
||||||
state: {byPos: 0, type: "tiddler"},
|
state: {byPos: 0, type: "tiddler"},
|
||||||
"default": {byName: true, type: "text"},
|
"default": {byName: true, type: "text"},
|
||||||
|
@ -27,7 +27,6 @@ var parseStory = function(storyText) {
|
|||||||
|
|
||||||
exports.macro = {
|
exports.macro = {
|
||||||
name: "story",
|
name: "story",
|
||||||
types: ["text/html","text/plain"],
|
|
||||||
params: {
|
params: {
|
||||||
story: {byName: "default", type: "tiddler"},
|
story: {byName: "default", type: "tiddler"},
|
||||||
template: {byName: true, type: "tiddler"}
|
template: {byName: true, type: "tiddler"}
|
||||||
|
@ -46,7 +46,6 @@ var Renderer = require("../Renderer.js").Renderer;
|
|||||||
|
|
||||||
exports.macro = {
|
exports.macro = {
|
||||||
name: "tiddler",
|
name: "tiddler",
|
||||||
types: ["text/html","text/plain"],
|
|
||||||
cascadeParams: true, // Cascade names of named parameters to following anonymous parameters
|
cascadeParams: true, // Cascade names of named parameters to following anonymous parameters
|
||||||
params: {
|
params: {
|
||||||
target: {byName: "default", type: "tiddler"},
|
target: {byName: "default", type: "tiddler"},
|
||||||
|
@ -11,7 +11,6 @@ var Renderer = require("../Renderer.js").Renderer;
|
|||||||
|
|
||||||
exports.macro = {
|
exports.macro = {
|
||||||
name: "version",
|
name: "version",
|
||||||
types: ["text/html","text/plain"],
|
|
||||||
params: {
|
params: {
|
||||||
},
|
},
|
||||||
execute: function() {
|
execute: function() {
|
||||||
|
@ -11,7 +11,6 @@ var Renderer = require("../Renderer.js").Renderer;
|
|||||||
|
|
||||||
exports.macro = {
|
exports.macro = {
|
||||||
name: "video",
|
name: "video",
|
||||||
types: ["text/html","text/plain"],
|
|
||||||
params: {
|
params: {
|
||||||
src: {byName: "default", type: "text"},
|
src: {byName: "default", type: "text"},
|
||||||
type: {byName: true, type: "text"},
|
type: {byName: true, type: "text"},
|
||||||
|
@ -13,7 +13,6 @@ var Renderer = require("../Renderer.js").Renderer,
|
|||||||
|
|
||||||
exports.macro = {
|
exports.macro = {
|
||||||
name: "view",
|
name: "view",
|
||||||
types: ["text/html","text/plain"],
|
|
||||||
params: {
|
params: {
|
||||||
field: {byPos: 0, type: "text"},
|
field: {byPos: 0, type: "text"},
|
||||||
format: {byPos: 1, type: "text"},
|
format: {byPos: 1, type: "text"},
|
||||||
|
Loading…
Reference in New Issue
Block a user