mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-05 01:26:18 +00:00
Set currentTiddler and ..currentTiddler for filter evaulation
This commit is contained in:
parent
fc3a764199
commit
9e41d410ee
@ -21,7 +21,18 @@ exports.cascade = function(operationSubFunction,options) {
|
||||
$tw.utils.each(inputResults,function(title) {
|
||||
var result = ""; // If no filter matches, we return an empty string
|
||||
$tw.utils.each(filterList,function(filter) {
|
||||
var output = options.wiki.filterTiddlers(filter,widget,options.wiki.makeTiddlerIterator([title]));
|
||||
var output = options.wiki.filterTiddlers(filter,{
|
||||
getVariable: function(name) {
|
||||
switch(name) {
|
||||
case "currentTiddler":
|
||||
return "" + title;
|
||||
case "..currentTiddler":
|
||||
return widget.getVariable("currentTiddler");
|
||||
default:
|
||||
return widget.getVariable(name);
|
||||
}
|
||||
}
|
||||
},options.wiki.makeTiddlerIterator([title]));
|
||||
if(output.length !== 0) {
|
||||
result = output[0];
|
||||
return false;
|
||||
|
@ -295,7 +295,7 @@ describe("'reduce' and 'intersection' filter prefix tests", function() {
|
||||
});
|
||||
wiki.addTiddler({
|
||||
title: "$:/filter2",
|
||||
text: "[tag[shopping]then[It is not customary]]",
|
||||
text: "[<currentTiddler>tag[shopping]then[It is not customary]]",
|
||||
tags: "$:/tags/Filter"
|
||||
});
|
||||
wiki.addTiddler({
|
||||
|
Loading…
Reference in New Issue
Block a user