diff --git a/core/modules/filters/inspect.js b/core/modules/filters/inspect.js index 7e38f5c68..131da61a2 100644 --- a/core/modules/filters/inspect.js +++ b/core/modules/filters/inspect.js @@ -27,20 +27,14 @@ exports.inspect = function(source,operator,options) { prefix: function(filterRunPrefixFunction,operationFunction,innerOptions) { return function(results,innerSource,innerWidget) { var details ={ + input: results.toArray(), prefixName: innerOptions.prefixName, operators: [] }; currentRun = details.operators; - var innerResults = filterRunPrefixFunction.call(this,operationFunction,innerOptions), - prefixOutput = new $tw.utils.LinkedList(); - innerResults(prefixOutput,innerSource,innerWidget); - var prefixOutputArray = prefixOutput.toArray(); - details.output = prefixOutputArray; + var innerResults = filterRunPrefixFunction.call(null,operationFunction,innerOptions); + innerResults(results,innerSource,innerWidget); output.runs.push(details); - results.clear(); - $tw.utils.each(prefixOutputArray,function(title) { - results.push(title); - }); }; }, operator: function(operatorFunction,innerSource,innerOperator,innerOptions) { @@ -52,17 +46,17 @@ exports.inspect = function(source,operator,options) { suffixes: innerOperator.suffixes, regexp: innerOperator.regexp, input: [] - }, - innerResults = operatorFunction.apply(self,Array.prototype.slice.call(arguments,1)); + }; innerSource(function(tiddler,title) { details.input.push(title); }); currentRun.push(details); + var innerResults = operatorFunction.apply(null,Array.prototype.slice.call(arguments,1)); return innerResults; } } }); - output.output = compiledFilter.call(this,source,options.widget); + output.output = compiledFilter.call(options.wiki,source,options.widget); var results = []; results.push(JSON.stringify(output,null,4)); return results; diff --git a/editions/test/tiddlers/tests/data/filter-wrappers/Simple.tid b/editions/test/tiddlers/tests/data/filter-wrappers/Simple.tid index 7694292e7..c082fe0d1 100644 --- a/editions/test/tiddlers/tests/data/filter-wrappers/Simple.tid +++ b/editions/test/tiddlers/tests/data/filter-wrappers/Simple.tid @@ -29,6 +29,7 @@ title: ExpectedResult ], "runs": [ { + "input": [], "prefixName": "or", "operators": [ { @@ -42,12 +43,12 @@ title: ExpectedResult "Output" ] } - ], - "output": [ - "1" ] }, { + "input": [ + "1" + ], "prefixName": "or", "operators": [ { @@ -61,12 +62,13 @@ title: ExpectedResult "Output" ] } - ], - "output": [ - "2" ] }, { + "input": [ + "1", + "2" + ], "prefixName": "or", "operators": [ { @@ -80,13 +82,12 @@ title: ExpectedResult "Output" ] } - ], - "output": [ - "3" ] } ], "output": [ + "1", + "2", "3" ] }

\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/inspect Operator.tid b/editions/tw5.com/tiddlers/filters/inspect Operator.tid index 44fef6e3d..44460ca1c 100644 --- a/editions/tw5.com/tiddlers/filters/inspect Operator.tid +++ b/editions/tw5.com/tiddlers/filters/inspect Operator.tid @@ -18,9 +18,9 @@ The JSON object contains the following properties: * `output`: the output titles resulting from evaluating the filter * `runs`: an array of objects, each of which represents a single run of the filter. Each object contains the following properties: ** `prefixName`: the name of the prefix operator that was used in this run +** `input`: the input titles passed to the prefix operator ** `operators`: an array of objects, each of which represents a single operator that was used in this run. Each object contains the following properties: *** `operatorName`: the name of the operator *** `operands`: an array of string operands passed to the operator *** `input`: the input titles passed to the operator -** `output`: the output titles resulting from evaluating this run