mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-27 01:14:44 +00:00
Add has:index (#4540)
* has:index * has:index * has:index docs * has op examples * has op examples * operator macros typo missing </div> * possible mistake
This commit is contained in:
parent
dc82365956
commit
69c8058b72
@ -3,7 +3,7 @@ title: $:/core/modules/filters/has.js
|
|||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: filteroperator
|
module-type: filteroperator
|
||||||
|
|
||||||
Filter operator for checking if a tiddler has the specified field
|
Filter operator for checking if a tiddler has the specified field or index
|
||||||
|
|
||||||
\*/
|
\*/
|
||||||
(function(){
|
(function(){
|
||||||
@ -33,7 +33,23 @@ exports.has = function(source,operator,options) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if(operator.suffix === "index") {
|
||||||
|
if(invert) {
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
if(!tiddler || (tiddler && (!$tw.utils.hop($tw.wiki.getTiddlerDataCached(tiddler,Object.create(null)),operator.operand)))) {
|
||||||
|
results.push(title);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
if(tiddler && $tw.utils.hop($tw.wiki.getTiddlerDataCached(tiddler,Object.create(null)),operator.operand)) {
|
||||||
|
results.push(title);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
if(invert) {
|
if(invert) {
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
if(!tiddler || !$tw.utils.hop(tiddler.fields,operator.operand) || (tiddler.fields[operator.operand] === "")) {
|
if(!tiddler || !$tw.utils.hop(tiddler.fields,operator.operand) || (tiddler.fields[operator.operand] === "")) {
|
||||||
|
@ -9,3 +9,5 @@ type: text/vnd.tiddlywiki
|
|||||||
<<.operator-example 2 "[tag[Concepts]!has[modified]]">>
|
<<.operator-example 2 "[tag[Concepts]!has[modified]]">>
|
||||||
<<.operator-example 3 "[has:field[emptyfield]]">>
|
<<.operator-example 3 "[has:field[emptyfield]]">>
|
||||||
<<.operator-example 4 "[all[current]!has:field[doesntexist]]">>
|
<<.operator-example 4 "[all[current]!has:field[doesntexist]]">>
|
||||||
|
<<.operator-example 5 "[all[tiddlers+shadows]has:index[foreground]]">>
|
||||||
|
<<.operator-example 6 "[all[current]!has:index[doesntexist]]">>
|
@ -2,12 +2,13 @@ caption: has
|
|||||||
created: 20140410103123179
|
created: 20140410103123179
|
||||||
modified: 20190518145446047
|
modified: 20190518145446047
|
||||||
op-input: a [[selection of titles|Title Selection]]
|
op-input: a [[selection of titles|Title Selection]]
|
||||||
op-neg-output: ''without suffix''<br>» those input tiddlers in which field <<.place F>> does <<.em not>> exist or has an empty value<br>''suffix `field`''<br>» those input tiddlers in which field <<.place F>> does <<.em not>> exist
|
op-neg-output: ''without suffix''<br>» those input tiddlers in which field <<.place F>> does <<.em not>> exist or has an empty value<br>''suffix `field`''<br>» those input tiddlers in which field <<.place F>> does <<.em not>> exist<br>''suffix `index`''<br>» those input tiddlers in which index <<.place F>> does <<.em not>> exist
|
||||||
op-output: ''without suffix''<br>» those input tiddlers in which field <<.place F>> has a non-empty value<br>''suffix `field`''<br>» those input tiddlers in which field <<.place F>> exists
|
op-output: ''without suffix''<br>» those input tiddlers in which field <<.place F>> has a non-empty value<br>''suffix `field`''<br>» those input tiddlers in which field <<.place F>> exists
|
||||||
op-parameter: the name of a [[field|TiddlerFields]]
|
op-parameter: the name of a [[field|TiddlerFields]]<br>''suffix `index`''<br>» those input tiddlers in which index <<.place F>> exists
|
||||||
|
op-parameter: the name of a [[field|TiddlerFields]] or, optionally an [[index|TextReference]]
|
||||||
op-parameter-name: F
|
op-parameter-name: F
|
||||||
op-purpose: filter the input by field existence
|
op-purpose: filter the input by field existence
|
||||||
op-suffix: <<.from-version "5.1.14">> optionally, the keyword `field`
|
op-suffix: <<.from-version "5.1.14">> optionally, the keyword `field` or <<.from-version "5.1.22">> optionally, the keyword `index`
|
||||||
op-suffix-name: S
|
op-suffix-name: S
|
||||||
tags: [[Filter Operators]] [[Common Operators]] [[Field Operators]] [[Negatable Operators]]
|
tags: [[Filter Operators]] [[Common Operators]] [[Field Operators]] [[Negatable Operators]]
|
||||||
title: has Operator
|
title: has Operator
|
||||||
|
Loading…
Reference in New Issue
Block a user