1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 02:19:55 +00:00

Return all tiddlers when "is" filter operand is missing

This commit is contained in:
Jermolene 2016-11-27 14:51:51 +00:00
parent 1a2ec12831
commit 0b4669621a
2 changed files with 15 additions and 6 deletions

View File

@ -28,11 +28,20 @@ Export our filter function
exports.is = function(source,operator,options) {
// Dispatch to the correct isfilteroperator
var isFilterOperators = getIsFilterOperators();
var isFilterOperator = isFilterOperators[operator.operand];
if(isFilterOperator) {
return isFilterOperator(source,operator.prefix,options);
if(operator.operand) {
var isFilterOperator = isFilterOperators[operator.operand];
if(isFilterOperator) {
return isFilterOperator(source,operator.prefix,options);
} else {
return [$tw.language.getString("Error/IsFilterOperator")];
}
} else {
return [$tw.language.getString("Error/IsFilterOperator")];
// Return all tiddlers if the operand is missing
var results = [];
source(function(tiddler,title) {
results.push(title);
});
return results;
}
};

View File

@ -1,5 +1,5 @@
created: 20140410103123179
modified: 20150220161001000
modified: 20161127142329969
tags: [[Filter Operators]] [[Common Operators]] [[Negatable Operators]]
title: is Operator
type: text/vnd.tiddlywiki
@ -23,7 +23,7 @@ The parameter <<.place C>> is one of the following fundamental categories:
|^`tag` |is in use as a tag |
|^`tiddler` |exists as a non-shadow tiddler |
If <<.place C>> is anything else, the output is an error message.
If <<.place C>> is anything else an error message is returned. <<.from-version "5.1.14"> if <<.place C>> is blank, the output is passed through unchanged (in earlier versions an error message was returned).
`!is[tiddler]` is a synonym for `is[missing]`, and vice versa.