mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-08-26 03:26:45 +00:00
31 lines
672 B
JavaScript
31 lines
672 B
JavaScript
![]() |
/*\
|
||
|
title: $:/core/modules/filters/lookup.js
|
||
|
type: application/javascript
|
||
|
module-type: filteroperator
|
||
|
|
||
|
Filter operator that looks up values via a title prefix
|
||
|
|
||
|
[lookup:<field>[<prefix>]]
|
||
|
|
||
|
Prepends the prefix to the selected items and returns the specified field value
|
||
|
|
||
|
\*/
|
||
|
(function(){
|
||
|
|
||
|
/*jslint node: true, browser: true */
|
||
|
/*global $tw: false */
|
||
|
"use strict";
|
||
|
|
||
|
/*
|
||
|
Export our filter function
|
||
|
*/
|
||
|
exports.lookup = function(source,operator,options) {
|
||
|
var results = [];
|
||
|
source(function(tiddler,title) {
|
||
|
results.push(options.wiki.getTiddlerText(operator.operand + title) || options.wiki.getTiddlerText(operator.operand + operator.suffix));
|
||
|
});
|
||
|
return results;
|
||
|
};
|
||
|
|
||
|
})();
|