이 문서는 https://tiddlywiki.com/languages/ko-KR/에서 티들리위키의 정적 HTML 표현의 일부입니다

Filter Filter Run Prefix (Examples)

2023년 3월 5일 오후 12:53

[tag[HelloThere]] :filter[get[text]length[]compare:integer:gteq[1000]]

[tag[HelloThere]] :filter[get[text]length[]compare:integer:lteq[2000]]

[tag[HelloThere]] :filter[get[text]length[]compare:integer:gteq[1000]] :filter[get[text]length[]compare:integer:lteq[2000]]

[tag[Features]] :filter[links[]!is[shadow]is[missing]]

A B C D E F :filter[<index>remainder[2]compare:integer:eq[0]]
→ Return every other element of the input list

[tag[shopping]] :filter[{!!quantity}compare:integer:gt[4]] :map[addprefix[ ]addprefix{!!quantity}]

[tag[shopping]] :filter[{!!quantity}compare:integer:lteq[4]] :map[addprefix[ ]addprefix{!!quantity}]

Comparison between :filter and :and/+ filter run prefixes

The functionality of the :filter filter run prefix has some overlap with the :and prefix (alias +). Notice the filter expressions above all have the following two properties:

  1. The start of the filter expression transforms the input titles (i.e. get[text]length[], links[], <index>remainder[2], {!!quantity}.
  2. The end of the filter expression only sends input items to the output if they meet some condition (i.e. compare, is).

The purpose of the :filter prefix is to return the original input titles despite property #1 causing those input titles to be transformed. That way, the "meet some condition" check can be performed on something other than the original input. If some filter expression does not require property #1, then the :and prefix can be used instead.

:filter:and
[tag[HelloThere]] :filter[get[text]length[]compare:integer:gteq[1000]]
[tag[HelloThere]] :and[get[text]length[]compare:integer:gteq[1000]]
[tag[Features]] :filter[links[]!is[shadow]is[missing]]
[tag[Features]] :and[links[]!is[shadow]is[missing]]
results are the same
cat can bat bug :filter[suffix[at]minlength[3]]
cat can bat bug :and[suffix[at]minlength[3]]