1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-28 11:00:27 +00:00

Removed unnecessary type declaration from macros

This commit is contained in:
Jeremy Ruston 2012-03-05 12:04:06 +00:00
parent 3633a40986
commit 8847551bd9
10 changed files with 18 additions and 29 deletions

View File

@ -11,7 +11,6 @@ var Renderer = require("../Renderer.js").Renderer;
exports.macro = {
name: "echo",
types: ["text/html","text/plain"],
params: {
text: {byPos: 0, type: "text"}
},

View File

@ -11,7 +11,6 @@ var Renderer = require("../Renderer.js").Renderer;
exports.macro = {
name: "image",
types: ["text/html","text/plain"],
params: {
src: {byName: "default", type: "tiddler"},
text: {byName: true, type: "text"},

View File

@ -16,7 +16,6 @@ var isLinkExternal = function(target) {
exports.macro = {
name: "link",
types: ["text/html","text/plain"],
params: {
target: {byName: "default", type: "tiddler", skinny: true}
},

View File

@ -34,7 +34,6 @@ var handlers = {
exports.macro = {
name: "list",
types: ["text/html","text/plain"],
dependentAll: true, // Tiddlers containing <<list>> macro are dependent on every tiddler
params: {
type: {byName: "default", type: "text"},

View File

@ -32,47 +32,45 @@ var Renderer = require("../Renderer.js").Renderer,
Tiddler = require("../Tiddler.js").Tiddler,
utils = require("../Utils.js");
function getOpenState() {
if(this.params.hasOwnProperty("state")) {
var stateTiddler = this.store.getTiddler(this.params.state);
function getOpenState(macroNode) {
if(macroNode.params.hasOwnProperty("state")) {
var stateTiddler = macroNode.store.getTiddler(macroNode.params.state);
if(stateTiddler) {
return stateTiddler.text.trim() === "open";
}
}
if(this.params.hasOwnProperty("default")) {
return this.params["default"] === "open";
if(macroNode.params.hasOwnProperty("default")) {
return macroNode.params["default"] === "open";
}
return false;
};
}
function saveOpenState() {
if(this.params.hasOwnProperty("state")) {
var stateTiddler = this.store.getTiddler(this.params.state) ||
new Tiddler({title: this.params.state, text: ""});
this.store.addTiddler(new Tiddler(stateTiddler,{text: this.isOpen ? "open" : "closed"}));
function saveOpenState(macroNode) {
if(macroNode.params.hasOwnProperty("state")) {
var stateTiddler = macroNode.store.getTiddler(macroNode.params.state) ||
new Tiddler({title: macroNode.params.state, text: ""});
macroNode.store.addTiddler(new Tiddler(stateTiddler,{text: macroNode.isOpen ? "open" : "closed"}));
return true;
}
return false;
}
function getSliderContent() {
if(this.params.hasOwnProperty("content")) {
return this.store.parseText("text/x-tiddlywiki",this.params.content).nodes;
} else if(this.params.hasOwnProperty("target")) {
function getSliderContent(macroNode) {
if(macroNode.params.hasOwnProperty("content")) {
return macroNode.store.parseText("text/x-tiddlywiki",macroNode.params.content).nodes;
} else if(macroNode.params.hasOwnProperty("target")) {
return [Renderer.MacroNode(
"tiddler",
{target: this.params.target},
{target: macroNode.params.target},
null,
this.store)];
macroNode.store)];
} else {
return [Renderer.ErrorNode("No content specified for slider")];
}
};
}
exports.macro = {
name: "slider",
types: ["text/html","text/plain"],
params: {
state: {byPos: 0, type: "tiddler"},
"default": {byName: true, type: "text"},

View File

@ -27,7 +27,6 @@ var parseStory = function(storyText) {
exports.macro = {
name: "story",
types: ["text/html","text/plain"],
params: {
story: {byName: "default", type: "tiddler"},
template: {byName: true, type: "tiddler"}

View File

@ -46,7 +46,6 @@ var Renderer = require("../Renderer.js").Renderer;
exports.macro = {
name: "tiddler",
types: ["text/html","text/plain"],
cascadeParams: true, // Cascade names of named parameters to following anonymous parameters
params: {
target: {byName: "default", type: "tiddler"},

View File

@ -11,7 +11,6 @@ var Renderer = require("../Renderer.js").Renderer;
exports.macro = {
name: "version",
types: ["text/html","text/plain"],
params: {
},
execute: function() {

View File

@ -11,7 +11,6 @@ var Renderer = require("../Renderer.js").Renderer;
exports.macro = {
name: "video",
types: ["text/html","text/plain"],
params: {
src: {byName: "default", type: "text"},
type: {byName: true, type: "text"},

View File

@ -13,7 +13,6 @@ var Renderer = require("../Renderer.js").Renderer,
exports.macro = {
name: "view",
types: ["text/html","text/plain"],
params: {
field: {byPos: 0, type: "text"},
format: {byPos: 1, type: "text"},