1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-25 23:03:15 +00:00

Merge pull request #1389 from aelocson/issue-1346

Fix #1346: Quotes around filter steps
This commit is contained in:
Jeremy Ruston 2015-01-27 13:55:12 +00:00
commit 01cd5302f3

View File

@ -13,8 +13,8 @@ Adds tiddler filtering methods to the $tw.Wiki object.
"use strict"; "use strict";
/* /*
Parses an operation within a filter string Parses an operation (i.e. a run) within a filter string
results: Array of array of operator nodes into which results should be inserted operators: Array of array of operator nodes into which results should be inserted
filterString: filter string filterString: filter string
p: start position within the string p: start position within the string
Returns the new start position, after the parsed operation Returns the new start position, after the parsed operation
@ -108,7 +108,7 @@ exports.parseFilter = function(filterString) {
p = 0, // Current position in the filter string p = 0, // Current position in the filter string
match; match;
var whitespaceRegExp = /(\s+)/mg, var whitespaceRegExp = /(\s+)/mg,
operandRegExp = /((?:\+|\-)?)(?:(\[)|("(?:[^"])*")|('(?:[^'])*')|([^\s\[\]]+))/mg; operandRegExp = /((?:\+|\-)?)(?:(\[)|(?:"([^"]*)")|(?:'([^']*)')|([^\s\[\]]+))/mg;
while(p < filterString.length) { while(p < filterString.length) {
// Skip any whitespace // Skip any whitespace
whitespaceRegExp.lastIndex = p; whitespaceRegExp.lastIndex = p;
@ -202,6 +202,7 @@ exports.compileFilter = function(filterString) {
if(operator.variable) { if(operator.variable) {
operand = widget.getVariable(operator.operand,{defaultValue: ""}); operand = widget.getVariable(operator.operand,{defaultValue: ""});
} }
// Invoke the appropriate filteroperator module
results = operatorFunction(accumulator,{ results = operatorFunction(accumulator,{
operator: operator.operator, operator: operator.operator,
operand: operand, operand: operand,