1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-26 01:50:28 +00:00

Rename internal "unknown" filter operator so that users cannot invoke it

This commit is contained in:
jeremy@jermolene.com 2022-05-11 14:52:25 +01:00
parent 774459fa73
commit 413dc86d05
2 changed files with 6 additions and 4 deletions

View File

@ -247,8 +247,8 @@ exports.compileFilter = function(filterString) {
// Use the "title" operator if no operator is specified
operatorFunction = filterOperators.title;
} else if(!filterOperators[operator.operator]) {
// Unknown operators treated as "unknown" - at run time we can distinguish between a custom operator and falling back to the default "field" operator
operatorFunction = filterOperators.unknown;
// Unknown operators treated as "[unknown]" - at run time we can distinguish between a custom operator and falling back to the default "field" operator
operatorFunction = filterOperators["[unknown]"];
} else {
// Use the operator function
operatorFunction = filterOperators[operator.operator];

View File

@ -3,7 +3,9 @@ title: $:/core/modules/filters/unknown.js
type: application/javascript
module-type: filteroperator
Filter operator for handling unknown filter operators
Filter operator for handling unknown filter operators.
Not intended to be used directly by end users, hence the square brackets around the name.
\*/
(function(){
@ -17,7 +19,7 @@ var fieldFilterOperatorFn = require("$:/core/modules/filters/field.js").field;
/*
Export our filter function
*/
exports.unknown = function(source,operator,options) {
exports["[unknown]"] = function(source,operator,options) {
var customDefinitionTitle = "[" + operator.operator + "[]]",
customDefinition = options.widget && options.widget.getVariableInfo && options.widget.getVariableInfo(customDefinitionTitle);
if(customDefinition && customDefinition.srcVariable && customDefinition.srcVariable.isFunctionDefinition) {