Rename the operator portion after the colon to "suffix"

print-window-tiddler
Jermolene 2014-01-24 19:15:27 +00:00
rodzic 42262a637c
commit a76da88380
2 zmienionych plików z 7 dodań i 11 usunięć

Wyświetl plik

@ -44,7 +44,7 @@ function parseFilterOperation(operators,filterString,p) {
// Any suffix?
var colon = operator.operator.indexOf(':');
if(colon > -1) {
operator.field = operator.operator.substring(colon + 1);
operator.suffix = operator.operator.substring(colon + 1);
operator.operator = operator.operator.substring(0,colon) || "field";
}
// Empty operator means: title
@ -186,7 +186,7 @@ exports.compileFilter = function(filterString) {
operator: operator.operator,
operand: operand,
prefix: operator.prefix,
field: operator.field,
suffix: operator.suffix,
regexp: operator.regexp
},{
wiki: self,

Wyświetl plik

@ -16,17 +16,17 @@ Filter operator for comparing fields for equality
Export our filter function
*/
exports.field = function(source,operator,options) {
var results = [];
var results = [],
fieldname = (operator.suffix || operator.operator).toLowerCase();
// Function to check an individual title
function checkTiddler(title) {
var tiddler = options.wiki.getTiddler(title);
if(tiddler) {
var match,
text = tiddler.getFieldString(operator.field);
text = tiddler.getFieldString(fieldname);
if(operator.regexp) {
match = !! operator.regexp.exec(text);
}
else {
match = !!operator.regexp.exec(text);
} else {
match = text === operator.operand;
}
if(operator.prefix === "!") {
@ -38,10 +38,6 @@ 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);