1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-25 01:20:30 +00:00

Fixed problem with view macro generating null content

Avoids errors better to generate empty content
This commit is contained in:
Jeremy Ruston 2012-06-11 17:36:28 +01:00
parent e3d667a3e0
commit e5ba101ebe

View File

@ -52,7 +52,7 @@ exports.executeMacro = function() {
switch(this.params.format) { switch(this.params.format) {
case "link": case "link":
if(value === undefined) { if(value === undefined) {
return null; return $tw.Tree.Text("");
} else { } else {
var link = $tw.Tree.Macro("link",{ var link = $tw.Tree.Macro("link",{
srcParams: {to: value}, srcParams: {to: value},
@ -86,7 +86,7 @@ exports.executeMacro = function() {
case "date": case "date":
var template = this.params.template || "DD MMM YYYY"; var template = this.params.template || "DD MMM YYYY";
if(value === undefined) { if(value === undefined) {
return null; return $tw.Tree.Text("");
} else { } else {
return $tw.Tree.Text($tw.utils.formatDateString(value,template)); return $tw.Tree.Text($tw.utils.formatDateString(value,template));
} }
@ -97,12 +97,12 @@ exports.executeMacro = function() {
value = tiddler.getFieldString(field); value = tiddler.getFieldString(field);
} }
if(value === undefined || value === null) { if(value === undefined || value === null) {
return null; return $tw.Tree.Text("");
} else { } else {
return $tw.Tree.Text(value); return $tw.Tree.Text(value);
} }
} }
return null; return $tw.Tree.Text("");
}; };
})(); })();