From 232cffb0a1e6c7527fa894285a3f43daca9df1ca Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Tue, 10 Sep 2024 18:13:09 +0200 Subject: [PATCH] Add type "number: (default)" to compare operator (#8160) * Add type "number: (default)" to compare operator * Update compare Operator.tid * Update compare Operator (Examples).tid * Update compare Operator (Examples).tid --- .../tiddlers/filters/compare Operator.tid | 18 +++++++++--------- .../examples/compare Operator (Examples).tid | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/editions/tw5.com/tiddlers/filters/compare Operator.tid b/editions/tw5.com/tiddlers/filters/compare Operator.tid index debf09ead..b86e8c729 100644 --- a/editions/tw5.com/tiddlers/filters/compare Operator.tid +++ b/editions/tw5.com/tiddlers/filters/compare Operator.tid @@ -1,15 +1,15 @@ +caption: compare created: 20200412181551706 modified: 20200412181551706 +op-input: a [[selection of titles|Title Selection]] +op-neg-output: those input titles <<.em not>> matching the specified comparison +op-output: those input titles matching the specified comparison +op-parameter: the value to compare +op-purpose: filter the input by comparing each item against the parameter +op-suffix: the <<.op compare>> operator uses a rich suffix, see below for details tags: [[Filter Operators]] [[Mathematics Operators]] [[String Operators]] [[Negatable Operators]] title: compare Operator type: text/vnd.tiddlywiki -caption: compare -op-purpose: filter the input by comparing each item against the parameter -op-input: a [[selection of titles|Title Selection]] -op-suffix: the <<.op compare>> operator uses a rich suffix, see below for details -op-parameter: the value to compare -op-output: those input titles matching the specified comparison -op-neg-output: those input titles <<.em not>> matching the specified comparison <<.from-version "5.1.22">>The <<.op compare>> filter allows numerical, string and date comparisons to be performed. @@ -21,7 +21,7 @@ The <<.op compare>> operator uses an extended syntax to specify all the options: The ''type'' can be: -* "number" - invalid numbers are interpreted as zero +* "number" - (default) invalid numbers are interpreted as zero * "integer" - invalid integers are interpreted as zero * "string" * "date" - invalid dates are interpreted as 1st January 1970 @@ -43,7 +43,7 @@ For example: ``` [[2]compare:number:eq[3]] returns nothing [[2]compare:number:lt[3]] returns "2" -[[2]compare:number:eq[2]] returns "2" +[[2]compare::eq[2]] returns "2" ``` Note that several of the variants of the <<.op compare>> operator are synonyms for existing operators, and are provided in the interests of consistency. For example, `compare:string:eq[x]` is a synonym for `match[x]`. diff --git a/editions/tw5.com/tiddlers/filters/examples/compare Operator (Examples).tid b/editions/tw5.com/tiddlers/filters/examples/compare Operator (Examples).tid index f729dc5d2..76488503a 100644 --- a/editions/tw5.com/tiddlers/filters/examples/compare Operator (Examples).tid +++ b/editions/tw5.com/tiddlers/filters/examples/compare Operator (Examples).tid @@ -9,3 +9,4 @@ type: text/vnd.tiddlywiki <<.operator-example 3 "[list[Days of the Week]compare:string:gt[M]compare:string:lt[W]]">> <<.operator-example 4 "[[v5.1.23-prerelease]compare:version:gt[v5.1.22]]">> <<.operator-example 5 "[[1]compare:number:gt[2]then[yes]else[no]]">> +<<.operator-example 6 "[[-2]compare::lt[-1]]">>