mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-17 11:30:02 +00:00
Add new "order" filter operator
This commit is contained in:
parent
a3dc3b4b98
commit
9a38642141
@ -12,6 +12,23 @@ Filter operators for manipulating the current selection list
|
|||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Order a list
|
||||||
|
*/
|
||||||
|
exports.order = function(source,operator,options) {
|
||||||
|
var results = [];
|
||||||
|
if(operator.operand.toLowerCase() === "reverse") {
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
results.unshift(title);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
results.push(title);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Reverse list
|
Reverse list
|
||||||
*/
|
*/
|
||||||
|
15
editions/tw5.com/tiddlers/filters/order_Operator.tid
Normal file
15
editions/tw5.com/tiddlers/filters/order_Operator.tid
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
caption: order
|
||||||
|
created: 20161128185907280
|
||||||
|
modified: 20161128191251557
|
||||||
|
op-input: a [[selection of titles|Title Selection]]
|
||||||
|
op-output: the input, with the order reversed if <<.field F>> is the special value `reverse`
|
||||||
|
op-parameter: Either the string `reverse` or another value
|
||||||
|
op-parameter-name: F
|
||||||
|
op-purpose: selectively reverse the input list
|
||||||
|
tags: [[Filter Operators]] [[Common Operators]] [[Field Operators]] [[Order Operators]]
|
||||||
|
title: order Operator
|
||||||
|
type: text/vnd.tiddlywiki
|
||||||
|
|
||||||
|
Either reverses or preserves the order of the input list according to whether the parameter is the special value `reverse`.
|
||||||
|
|
||||||
|
<<.operator-examples "order">>
|
Loading…
x
Reference in New Issue
Block a user