mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-09-27 06:38:19 +00:00
Add is[variable] filter
See discussion here https://groups.google.com/d/topic/tiddlywiki/4rEuAWc4EpM/discussion
This commit is contained in:
parent
810033bd71
commit
36e76429b1
36
core/modules/filters/is/variable.js
Normal file
36
core/modules/filters/is/variable.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*\
|
||||||
|
title: $:/core/modules/filters/is/variable.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: isfilteroperator
|
||||||
|
|
||||||
|
Filter function for [is[variable]]
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Export our filter function
|
||||||
|
*/
|
||||||
|
exports.variable = function(source,prefix,options) {
|
||||||
|
var results = [];
|
||||||
|
if(prefix === "!") {
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
if(!title in options.widget.variables) {
|
||||||
|
results.push(title);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
if(title in options.widget.variables) {
|
||||||
|
results.push(title);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
@ -1,5 +1,5 @@
|
|||||||
created: 20140410103123179
|
created: 20140410103123179
|
||||||
modified: 20161127142329969
|
modified: 20190225130632157
|
||||||
tags: [[Filter Operators]] [[Common Operators]] [[Negatable Operators]]
|
tags: [[Filter Operators]] [[Common Operators]] [[Negatable Operators]]
|
||||||
title: is Operator
|
title: is Operator
|
||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
@ -22,6 +22,7 @@ The parameter <<.place C>> is one of the following fundamental categories:
|
|||||||
|^`system` |is a [[system tiddler|SystemTiddlers]], i.e. its title starts with `$:/` |
|
|^`system` |is a [[system tiddler|SystemTiddlers]], i.e. its title starts with `$:/` |
|
||||||
|^`tag` |is in use as a tag |
|
|^`tag` |is in use as a tag |
|
||||||
|^`tiddler` |exists as a non-shadow tiddler |
|
|^`tiddler` |exists as a non-shadow tiddler |
|
||||||
|
|^`variable` |<<.from-version "5.1.20">> exists as a variable (whether or not it has a non-blank value) |
|
||||||
|
|
||||||
If <<.place C>> is anything else an error message is returned. <<.from-version "5.1.14">> if <<.place C>> is blank, the output is passed through unchanged (in earlier versions an error message was returned).
|
If <<.place C>> is anything else an error message is returned. <<.from-version "5.1.14">> if <<.place C>> is blank, the output is passed through unchanged (in earlier versions an error message was returned).
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user