mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-02 12:19:11 +00:00
implemented the field: syntax
This commit is contained in:
parent
a5d75db8d2
commit
0338c36610
@ -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,
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user