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",
|
name: "echo",
|
||||||
types: ["text/html","text/plain"],
|
types: ["text/html","text/plain"],
|
||||||
params: {
|
params: {
|
||||||
text: {byPos: 0, type: "text", optional: false}
|
text: {byPos: 0, type: "text"}
|
||||||
},
|
},
|
||||||
execute: function(macroNode,tiddler,store) {
|
execute: function(macroNode,tiddler,store) {
|
||||||
return [Renderer.TextNode(macroNode.params.text)];
|
return [Renderer.TextNode(macroNode.params.text)];
|
||||||
|
@ -13,9 +13,9 @@ exports.macro = {
|
|||||||
name: "image",
|
name: "image",
|
||||||
types: ["text/html","text/plain"],
|
types: ["text/html","text/plain"],
|
||||||
params: {
|
params: {
|
||||||
src: {byName: "default", type: "tiddler", optional: false},
|
src: {byName: "default", type: "tiddler"},
|
||||||
text: {byName: true, type: "text", optional: true},
|
text: {byName: true, type: "text"},
|
||||||
alignment: {byName: true, type: "text", optional: true}
|
alignment: {byName: true, type: "text"}
|
||||||
},
|
},
|
||||||
execute: function(macroNode,tiddler,store) {
|
execute: function(macroNode,tiddler,store) {
|
||||||
if(store.tiddlerExists(macroNode.params.src)) {
|
if(store.tiddlerExists(macroNode.params.src)) {
|
||||||
|
@ -14,7 +14,7 @@ exports.macro = {
|
|||||||
name: "info",
|
name: "info",
|
||||||
types: ["text/html","text/plain"],
|
types: ["text/html","text/plain"],
|
||||||
params: {
|
params: {
|
||||||
info: {byName: "default", type: "text", optional: false}
|
info: {byName: "default", type: "text"}
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
click: function(event,node,tiddler,store,params) {
|
click: function(event,node,tiddler,store,params) {
|
||||||
|
@ -18,7 +18,7 @@ exports.macro = {
|
|||||||
name: "link",
|
name: "link",
|
||||||
types: ["text/html","text/plain"],
|
types: ["text/html","text/plain"],
|
||||||
params: {
|
params: {
|
||||||
target: {byName: "default", type: "tiddler", skinny: true, optional: false}
|
target: {byName: "default", type: "tiddler", skinny: true}
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
click: function(event,macroNode) {
|
click: function(event,macroNode) {
|
||||||
|
@ -37,9 +37,9 @@ exports.macro = {
|
|||||||
types: ["text/html","text/plain"],
|
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", optional: false},
|
type: {byName: "default", type: "text"},
|
||||||
template: {byName: true, type: "tiddler", optional: true},
|
template: {byName: true, type: "tiddler"},
|
||||||
emptyMessage: {byName: true, type: "text", optional: true}
|
emptyMessage: {byName: true, type: "text"}
|
||||||
},
|
},
|
||||||
execute: function(macroNode,tiddler,store) {
|
execute: function(macroNode,tiddler,store) {
|
||||||
var templateType = "text/x-tiddlywiki",
|
var templateType = "text/x-tiddlywiki",
|
||||||
|
@ -16,10 +16,10 @@ exports.macro = {
|
|||||||
name: "slider",
|
name: "slider",
|
||||||
types: ["text/html","text/plain"],
|
types: ["text/html","text/plain"],
|
||||||
params: {
|
params: {
|
||||||
state: {byPos: 0, type: "text", optional: false},
|
state: {byPos: 0, type: "text"},
|
||||||
targetTiddler: {byPos: 1, type: "tiddler", optional: false},
|
targetTiddler: {byPos: 1, type: "tiddler"},
|
||||||
label: {byPos: 2, type: "text", optional: false},
|
label: {byPos: 2, type: "text"},
|
||||||
tooltip: {byPos: 3, type: "text", optional: true}
|
tooltip: {byPos: 3, type: "text"}
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
click: function(event,macroNode) {
|
click: function(event,macroNode) {
|
||||||
|
@ -29,8 +29,8 @@ exports.macro = {
|
|||||||
name: "story",
|
name: "story",
|
||||||
types: ["text/html","text/plain"],
|
types: ["text/html","text/plain"],
|
||||||
params: {
|
params: {
|
||||||
story: {byName: "default", type: "tiddler", optional: false},
|
story: {byName: "default", type: "tiddler"},
|
||||||
template: {byName: true, type: "tiddler", optional: true}
|
template: {byName: true, type: "tiddler"}
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
"tw-navigate": function(event,macroNode) {
|
"tw-navigate": function(event,macroNode) {
|
||||||
|
@ -49,9 +49,9 @@ exports.macro = {
|
|||||||
types: ["text/html","text/plain"],
|
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", optional: true},
|
target: {byName: "default", type: "tiddler"},
|
||||||
template: {byName: true, type: "tiddler", optional: true},
|
template: {byName: true, type: "tiddler"},
|
||||||
"with": {byName: true, type: "text", optional: true, dependentAll: true}
|
"with": {byName: true, type: "text", dependentAll: true}
|
||||||
},
|
},
|
||||||
execute: function(macroNode,tiddler,store) {
|
execute: function(macroNode,tiddler,store) {
|
||||||
var renderTitle = macroNode.params.target,
|
var renderTitle = macroNode.params.target,
|
||||||
|
@ -13,10 +13,10 @@ exports.macro = {
|
|||||||
name: "video",
|
name: "video",
|
||||||
types: ["text/html","text/plain"],
|
types: ["text/html","text/plain"],
|
||||||
params: {
|
params: {
|
||||||
src: {byName: "default", type: "text", optional: false},
|
src: {byName: "default", type: "text"},
|
||||||
type: {byName: true, type: "text", optional: true},
|
type: {byName: true, type: "text"},
|
||||||
width: {byName: true, type: "text", optional: true},
|
width: {byName: true, type: "text"},
|
||||||
height: {byName: true, type: "text", optional: true}
|
height: {byName: true, type: "text"}
|
||||||
},
|
},
|
||||||
execute: function(macroNode,tiddler,store) {
|
execute: function(macroNode,tiddler,store) {
|
||||||
var src = macroNode.params.src,
|
var src = macroNode.params.src,
|
||||||
|
@ -15,9 +15,9 @@ exports.macro = {
|
|||||||
name: "view",
|
name: "view",
|
||||||
types: ["text/html","text/plain"],
|
types: ["text/html","text/plain"],
|
||||||
params: {
|
params: {
|
||||||
field: {byPos: 0, type: "text", optional: false},
|
field: {byPos: 0, type: "text"},
|
||||||
format: {byPos: 1, type: "text", optional: true},
|
format: {byPos: 1, type: "text"},
|
||||||
template: {byPos: 2, type: "text", optional: true}
|
template: {byPos: 2, type: "text"}
|
||||||
},
|
},
|
||||||
execute: function(macroNode,tiddler,store) {
|
execute: function(macroNode,tiddler,store) {
|
||||||
if(!tiddler) {
|
if(!tiddler) {
|
||||||
|
Loading…
Reference in New Issue
Block a user