diff --git a/core/modules/filters/is.js b/core/modules/filters/is.js index 99d86597f..c1add6f61 100644 --- a/core/modules/filters/is.js +++ b/core/modules/filters/is.js @@ -27,40 +27,44 @@ Export our filter function */ exports.is = function(source,operator,options) { + var isFilterOperators = getIsFilterOperators(), + subops = operator.operand.split("+"), + num_of_subops = subops.length; - if( !operator.operand) { - // Return all tiddlers if the operand is missing + //Make sure all the operands are defined. + for (var t = 0; t < num_of_subops; t++){ + if( !isFilterOperators[subops[t]] ) { + return [$tw.language.getString("Error/IsFilterOperator")]; + } + } + + if(num_of_subops === 0) { // Return all tiddlers if the operand is missing var results = []; source(function(tiddler,title) { results.push(title); }); return results; - } + } else if(num_of_subops === 1) { // Shortcut the Single Operator + var operator = isFilterOperators[subops[0]]; + return operator(source,operator.prefix,options); - // Get our isfilteroperators - var isFilterOperators = getIsFilterOperators(), - subops = operator.operand.split("+"), - filteredResults = {}, - results = []; - for (var t=0; t> belong to category <<.pl The parameter <<.place C>> specifies zero or more fundamental categories using the following syntax: <$railroad text=""" -[{: ("current" | "missing" |: "orphans" | "shadows" | "tags" | "tiddlers" ) +"+" }] +[{: ("current" | "missing" |: "orphan" | "shadow" | "system" | "tag" | "tiddler" | "image") +"+" }] """/> |!Category |!Matches any tiddler that... |