1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 03:57:21 +00:00

Change "is" filter with blank operand to pass through arguments

This commit is contained in:
Jermolene 2016-11-28 13:42:06 +00:00
parent 4e0aea288d
commit c460cc03a4
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.