2013-05-25 16:26:22 +00:00
|
|
|
/*\
|
|
|
|
title: $:/core/modules/filters/list.js
|
|
|
|
type: application/javascript
|
|
|
|
module-type: filteroperator
|
2015-02-16 17:31:50 +00:00
|
|
|
|
2013-05-25 16:26:22 +00:00
|
|
|
Filter operator returning the tiddlers whose title is listed in the operand tiddler
|
2015-02-16 17:31:50 +00:00
|
|
|
|
2013-05-25 16:26:22 +00:00
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true, browser: true */
|
|
|
|
/*global $tw: false */
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
/*
|
|
|
|
Export our filter function
|
|
|
|
*/
|
|
|
|
exports.list = function(source,operator,options) {
|
|
|
|
var results = [],
|
2014-01-25 18:14:30 +00:00
|
|
|
tr = $tw.utils.parseTextReference(operator.operand),
|
2014-04-27 19:03:33 +00:00
|
|
|
currTiddlerTitle = options.widget && options.widget.getVariable("currentTiddler"),
|
|
|
|
list = options.wiki.getTiddlerList(tr.title || currTiddlerTitle,tr.field,tr.index);
|
2014-04-03 19:49:16 +00:00
|
|
|
if(operator.prefix === "!") {
|
|
|
|
source(function(tiddler,title) {
|
|
|
|
if(list.indexOf(title) === -1) {
|
|
|
|
results.push(title);
|
|
|
|
}
|
2013-05-25 16:26:22 +00:00
|
|
|
});
|
|
|
|
} else {
|
2015-02-16 19:17:10 +00:00
|
|
|
results = list;
|
2013-05-25 16:26:22 +00:00
|
|
|
}
|
|
|
|
return results;
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|