2017-09-07 14:48:00 +00:00
|
|
|
/*\
|
|
|
|
title: $:/core/modules/filters/lookup.js
|
|
|
|
type: application/javascript
|
|
|
|
module-type: filteroperator
|
|
|
|
|
|
|
|
Filter operator that looks up values via a title prefix
|
|
|
|
|
2021-05-26 12:25:19 +00:00
|
|
|
[lookup:<field>[<prefix>]]
|
2017-09-07 14:48:00 +00:00
|
|
|
|
2021-05-26 12:25:19 +00:00
|
|
|
Prepends the prefix to the selected items and returns the specified field value
|
2017-09-07 14:48:00 +00:00
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true, browser: true */
|
|
|
|
/*global $tw: false */
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
/*
|
|
|
|
Export our filter function
|
|
|
|
*/
|
|
|
|
exports.lookup = function(source,operator,options) {
|
2021-05-26 12:25:19 +00:00
|
|
|
var results = [];
|
|
|
|
source(function(tiddler,title) {
|
|
|
|
results.push(options.wiki.getTiddlerText(operator.operand + title) || operator.suffix || '');
|
|
|
|
});
|
2017-09-07 14:48:00 +00:00
|
|
|
return results;
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|