diff --git a/core/modules/filters.js b/core/modules/filters.js index 3aeebcaaa..2b7f87fa4 100644 --- a/core/modules/filters.js +++ b/core/modules/filters.js @@ -48,6 +48,11 @@ function parseFilterOperation(operators,filterString,p) { operator.operator = filterString.substring(p,bracketPos); p = bracketPos + 1; } + var colon = operator.operator.indexOf(':'); + if(colon > -1) { + operator.field = operator.operator.substring(colon+1); + operator.operator = operator.operator.substring(0,colon); + } if(operator.operator === "") { operator.operator = "title"; } @@ -180,6 +185,7 @@ exports.compileFilter = function(filterString) { operator: operator.operator, operand: operand, prefix: operator.prefix, + field: operator.field, regexp: operator.regexp },{ wiki: self, diff --git a/core/modules/filters/field.js b/core/modules/filters/field.js index efbcd50df..b3b2d2787 100644 --- a/core/modules/filters/field.js +++ b/core/modules/filters/field.js @@ -22,7 +22,7 @@ exports.field = function(source,operator,options) { var tiddler = options.wiki.getTiddler(title); if(tiddler) { var match, - text = tiddler.getFieldString(operator.operator.replace(/:$/, "")); + text = tiddler.getFieldString(operator.field); if(operator.regexp) { match = !! operator.regexp.exec(text); } @@ -38,6 +38,10 @@ exports.field = function(source,operator,options) { } } // Iterate through the source tiddlers + if(!operator.field) { + operator.field = operator.operator; + } + operator.field.toLowerCase(); if($tw.utils.isArray(source)) { $tw.utils.each(source,function(title) { checkTiddler(title);