mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-09-12 15:56:05 +00:00
Merge branch 'master' of https://github.com/Jermolene/TiddlyWiki5
This commit is contained in:
31
core/modules/filterrunprefixes/filter.js
Normal file
31
core/modules/filterrunprefixes/filter.js
Normal file
@@ -0,0 +1,31 @@
|
||||
/*\
|
||||
title: $:/core/modules/filterrunprefixes/filter.js
|
||||
type: application/javascript
|
||||
module-type: filterrunprefix
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.filter = function(operationSubFunction) {
|
||||
return function(results,source,widget) {
|
||||
if(results.length > 0) {
|
||||
var resultsToRemove = [];
|
||||
$tw.utils.each(results,function(result) {
|
||||
var filtered = operationSubFunction($tw.wiki.makeTiddlerIterator([result]),widget);
|
||||
if(filtered.length === 0) {
|
||||
resultsToRemove.push(result);
|
||||
}
|
||||
});
|
||||
$tw.utils.removeArrayEntries(results,resultsToRemove);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
@@ -1,5 +1,5 @@
|
||||
created: 20150124182421000
|
||||
modified: 20190610165329062
|
||||
modified: 20201027134811701
|
||||
tags: [[Filter Syntax]]
|
||||
title: Filter Expression
|
||||
type: text/vnd.tiddlywiki
|
||||
@@ -21,15 +21,16 @@ If a run has:
|
||||
* the prefix `-`, output titles are <<.em removed>> from the filter's output (if such tiddlers exist)
|
||||
* the prefix `+`, it receives the filter output so far as its input; its output then <<.em "replaces">> all filter ouput so far and forms the input for the next run
|
||||
* <<.from-version "5.1.18">> the prefix `~`, if the filter output so far is an empty list then the output titles of the run are [[dominantly appended|Dominant Append]] to the filter's output. If the filter output so far is not an empty list then the run is ignored
|
||||
* <<.from-version "5.1.23">> named prefixes for filter runs are available.
|
||||
|
||||
In technical / logical terms:
|
||||
|
||||
|!Run |!Interpretation |!Output |
|
||||
|`run` |de-duplicated union of sets |... OR run |
|
||||
|`=run` |union of sets without de-duplication |... OR run |
|
||||
|`+run` |intersection of sets |... AND run |
|
||||
|`-run` |difference of sets |... AND NOT run |
|
||||
|`~run` |else |... ELSE run |
|
||||
|!Run |!Equivalent named prefix |!Interpretation |!Output |
|
||||
|`run` |`:or[run]` |de-duplicated union of sets |... OR run |
|
||||
|`=run` |`:all[run]` |union of sets without de-duplication |... OR run |
|
||||
|`+run` |`:and[run]` |intersection of sets |... AND run |
|
||||
|`-run` |`:except[run]` |difference of sets |... AND NOT run |
|
||||
|`~run` |`:else[run]` |else |... ELSE run |
|
||||
|
||||
The input of a run is normally a list of all the non-[[shadow|ShadowTiddlers]] tiddler titles in the wiki (in no particular order). But the `+` prefix can change this:
|
||||
|
||||
|
Reference in New Issue
Block a user