mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-07 11:16:55 +00:00
Adjust field and has filter handling of missing tiddlers
Now `[!field:name[value]]` and `[!has[name]` will treat missing tiddlers as not having the specified field
This commit is contained in:
parent
156d3bc692
commit
42dba113cc
@ -26,6 +26,8 @@ exports.field = function(source,operator,options) {
|
||||
if(text !== null && !operator.regexp.exec(text)) {
|
||||
results.push(title);
|
||||
}
|
||||
} else {
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@ -35,6 +37,8 @@ exports.field = function(source,operator,options) {
|
||||
if(text !== null && text !== operator.operand) {
|
||||
results.push(title);
|
||||
}
|
||||
} else {
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ exports.has = function(source,operator,options) {
|
||||
var results = [];
|
||||
if(operator.prefix === "!") {
|
||||
source(function(tiddler,title) {
|
||||
if(tiddler && (!$tw.utils.hop(tiddler.fields,operator.operand) || tiddler.fields[operator.operand] === "")) {
|
||||
if(!tiddler || (tiddler && (!$tw.utils.hop(tiddler.fields,operator.operand) || tiddler.fields[operator.operand] === ""))) {
|
||||
results.push(title);
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user