1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-02-23 14:30:02 +00:00

Make $tw.utils.stringifyList() resilient to null values in the array

This commit is contained in:
Jermolene 2016-09-30 18:28:12 +01:00
parent b867b7487e
commit 20daaae7e8

View File

@ -251,15 +251,20 @@ $tw.utils.parseDate = function(value) {
// Stringify an array of tiddler titles into a list string // Stringify an array of tiddler titles into a list string
$tw.utils.stringifyList = function(value) { $tw.utils.stringifyList = function(value) {
if($tw.utils.isArray(value)) {
var result = []; var result = [];
for(var t=0; t<value.length; t++) { for(var t=0; t<value.length; t++) {
if(value[t].indexOf(" ") !== -1) { var entry = value[t] || "";
result.push("[[" + value[t] + "]]"); if(entry.indexOf(" ") !== -1) {
result.push("[[" + entry + "]]");
} else { } else {
result.push(value[t]); result.push(entry);
} }
} }
return result.join(" "); return result.join(" ");
} else {
return value || "";
}
}; };
// Parse a string array from a bracketted list. For example "OneTiddler [[Another Tiddler]] LastOne" // Parse a string array from a bracketted list. For example "OneTiddler [[Another Tiddler]] LastOne"