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:
parent
94a84d8bc6
commit
1326b12948
@ -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)];
|
||||
|
@ -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)) {
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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",
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user