mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-08 23:20:03 +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);
|
operator.operator = filterString.substring(p,bracketPos);
|
||||||
p = bracketPos + 1;
|
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 === "") {
|
if(operator.operator === "") {
|
||||||
operator.operator = "title";
|
operator.operator = "title";
|
||||||
}
|
}
|
||||||
@ -180,6 +185,7 @@ exports.compileFilter = function(filterString) {
|
|||||||
operator: operator.operator,
|
operator: operator.operator,
|
||||||
operand: operand,
|
operand: operand,
|
||||||
prefix: operator.prefix,
|
prefix: operator.prefix,
|
||||||
|
field: operator.field,
|
||||||
regexp: operator.regexp
|
regexp: operator.regexp
|
||||||
},{
|
},{
|
||||||
wiki: self,
|
wiki: self,
|
||||||
|
@ -22,7 +22,7 @@ exports.field = function(source,operator,options) {
|
|||||||
var tiddler = options.wiki.getTiddler(title);
|
var tiddler = options.wiki.getTiddler(title);
|
||||||
if(tiddler) {
|
if(tiddler) {
|
||||||
var match,
|
var match,
|
||||||
text = tiddler.getFieldString(operator.operator.replace(/:$/, ""));
|
text = tiddler.getFieldString(operator.field);
|
||||||
if(operator.regexp) {
|
if(operator.regexp) {
|
||||||
match = !! operator.regexp.exec(text);
|
match = !! operator.regexp.exec(text);
|
||||||
}
|
}
|
||||||
@ -38,6 +38,10 @@ exports.field = function(source,operator,options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Iterate through the source tiddlers
|
// Iterate through the source tiddlers
|
||||||
|
if(!operator.field) {
|
||||||
|
operator.field = operator.operator;
|
||||||
|
}
|
||||||
|
operator.field.toLowerCase();
|
||||||
if($tw.utils.isArray(source)) {
|
if($tw.utils.isArray(source)) {
|
||||||
$tw.utils.each(source,function(title) {
|
$tw.utils.each(source,function(title) {
|
||||||
checkTiddler(title);
|
checkTiddler(title);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user