diff --git a/core/modules/filterrunprefixes/apply.js b/core/modules/filterrunprefixes/apply.js new file mode 100644 index 000000000..7673e7729 --- /dev/null +++ b/core/modules/filterrunprefixes/apply.js @@ -0,0 +1,29 @@ +/*\ +title: $:/core/modules/filterrunprefixes/apply.js +type: application/javascript +module-type: filterrunprefix + + + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports.apply = function(operationSubFunction) { + return function(results,source,widget) { + source = widget.wiki.makeTiddlerIterator([]); + var variables = {}, + counter = 1; + results.each(function(title) { + variables["$" + counter] = title; + counter++; + }); + results.clear(); + results.pushTop(operationSubFunction(source,widget.makeFakeWidgetWithVariables(variables))); + }; +}; + +})(); diff --git a/editions/test/tiddlers/tests/data/filters/FilterRunPrefixesApply.tid b/editions/test/tiddlers/tests/data/filters/FilterRunPrefixesApply.tid new file mode 100644 index 000000000..5ed5a728e --- /dev/null +++ b/editions/test/tiddlers/tests/data/filters/FilterRunPrefixesApply.tid @@ -0,0 +1,13 @@ +title: Filters/FilterRunPrefixes/Applu +description: Applu filter run prefix +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Output + +\whitespace trim +<$text text={{{ a b c :apply[<$1>addsuffix<$2>addsuffix<$3>] }}}/> ++ +title: ExpectedResult + +
abc
\ No newline at end of file