1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

Removed "optional" field from macro parameters

Macros need to tolerate missing parameters
This commit is contained in:
Jeremy Ruston 2012-02-17 17:32:32 +00:00
parent 94a84d8bc6
commit 1326b12948
10 changed files with 25 additions and 25 deletions

View File

@ -13,7 +13,7 @@ exports.macro = {
name: "echo",
types: ["text/html","text/plain"],
params: {
text: {byPos: 0, type: "text", optional: false}
text: {byPos: 0, type: "text"}
},
execute: function(macroNode,tiddler,store) {
return [Renderer.TextNode(macroNode.params.text)];

View File

@ -13,9 +13,9 @@ exports.macro = {
name: "image",
types: ["text/html","text/plain"],
params: {
src: {byName: "default", type: "tiddler", optional: false},
text: {byName: true, type: "text", optional: true},
alignment: {byName: true, type: "text", optional: true}
src: {byName: "default", type: "tiddler"},
text: {byName: true, type: "text"},
alignment: {byName: true, type: "text"}
},
execute: function(macroNode,tiddler,store) {
if(store.tiddlerExists(macroNode.params.src)) {

View File

@ -14,7 +14,7 @@ exports.macro = {
name: "info",
types: ["text/html","text/plain"],
params: {
info: {byName: "default", type: "text", optional: false}
info: {byName: "default", type: "text"}
},
events: {
click: function(event,node,tiddler,store,params) {

View File

@ -18,7 +18,7 @@ exports.macro = {
name: "link",
types: ["text/html","text/plain"],
params: {
target: {byName: "default", type: "tiddler", skinny: true, optional: false}
target: {byName: "default", type: "tiddler", skinny: true}
},
events: {
click: function(event,macroNode) {

View File

@ -37,9 +37,9 @@ exports.macro = {
types: ["text/html","text/plain"],
dependentAll: true, // Tiddlers containing <<list>> macro are dependent on every tiddler
params: {
type: {byName: "default", type: "text", optional: false},
template: {byName: true, type: "tiddler", optional: true},
emptyMessage: {byName: true, type: "text", optional: true}
type: {byName: "default", type: "text"},
template: {byName: true, type: "tiddler"},
emptyMessage: {byName: true, type: "text"}
},
execute: function(macroNode,tiddler,store) {
var templateType = "text/x-tiddlywiki",

View File

@ -16,10 +16,10 @@ exports.macro = {
name: "slider",
types: ["text/html","text/plain"],
params: {
state: {byPos: 0, type: "text", optional: false},
targetTiddler: {byPos: 1, type: "tiddler", optional: false},
label: {byPos: 2, type: "text", optional: false},
tooltip: {byPos: 3, type: "text", optional: true}
state: {byPos: 0, type: "text"},
targetTiddler: {byPos: 1, type: "tiddler"},
label: {byPos: 2, type: "text"},
tooltip: {byPos: 3, type: "text"}
},
events: {
click: function(event,macroNode) {

View File

@ -29,8 +29,8 @@ exports.macro = {
name: "story",
types: ["text/html","text/plain"],
params: {
story: {byName: "default", type: "tiddler", optional: false},
template: {byName: true, type: "tiddler", optional: true}
story: {byName: "default", type: "tiddler"},
template: {byName: true, type: "tiddler"}
},
events: {
"tw-navigate": function(event,macroNode) {

View File

@ -49,9 +49,9 @@ exports.macro = {
types: ["text/html","text/plain"],
cascadeParams: true, // Cascade names of named parameters to following anonymous parameters
params: {
target: {byName: "default", type: "tiddler", optional: true},
template: {byName: true, type: "tiddler", optional: true},
"with": {byName: true, type: "text", optional: true, dependentAll: true}
target: {byName: "default", type: "tiddler"},
template: {byName: true, type: "tiddler"},
"with": {byName: true, type: "text", dependentAll: true}
},
execute: function(macroNode,tiddler,store) {
var renderTitle = macroNode.params.target,

View File

@ -13,10 +13,10 @@ exports.macro = {
name: "video",
types: ["text/html","text/plain"],
params: {
src: {byName: "default", type: "text", optional: false},
type: {byName: true, type: "text", optional: true},
width: {byName: true, type: "text", optional: true},
height: {byName: true, type: "text", optional: true}
src: {byName: "default", type: "text"},
type: {byName: true, type: "text"},
width: {byName: true, type: "text"},
height: {byName: true, type: "text"}
},
execute: function(macroNode,tiddler,store) {
var src = macroNode.params.src,

View File

@ -15,9 +15,9 @@ exports.macro = {
name: "view",
types: ["text/html","text/plain"],
params: {
field: {byPos: 0, type: "text", optional: false},
format: {byPos: 1, type: "text", optional: true},
template: {byPos: 2, type: "text", optional: true}
field: {byPos: 0, type: "text"},
format: {byPos: 1, type: "text"},
template: {byPos: 2, type: "text"}
},
execute: function(macroNode,tiddler,store) {
if(!tiddler) {