mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-10 11:59:58 +00:00
parent
1d0dc60a2d
commit
570cad1c7f
31
core/modules/filters/get.js
Normal file
31
core/modules/filters/get.js
Normal file
@ -0,0 +1,31 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/get.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operator for replacing tiddler titles by the value of the field specified in the operand.
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.get = function(source,operator,options) {
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler) {
|
||||
var value = tiddler.getFieldString(operator.operand);
|
||||
if(value) {
|
||||
results.push(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
12
editions/tw5.com/tiddlers/filters/FilterOperator get.tid
Normal file
12
editions/tw5.com/tiddlers/filters/FilterOperator get.tid
Normal file
@ -0,0 +1,12 @@
|
||||
created: 20140426183123179
|
||||
modified: 20140426183123179
|
||||
tags: filters
|
||||
title: FilterOperator: get
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The ''get'' filter operator replaces the titles of the tiddlers in the current list with the values of the field specified by the operand.
|
||||
|
||||
For example:
|
||||
|
||||
|!Filter String |!Description |
|
||||
|`[all[current]get[draft.of]]` |If the current tiddler is a draft, returns the original tiddler, otherwise returns an empty list |
|
Loading…
Reference in New Issue
Block a user