22 juin 2015 à 10h59
Un opérateur de filtre est un motclé prédéfini attaché à une étape individuelle d'un filtre. Il définit une action particulière de cette étape.
Le tableau suivant liste tous les opérateurs du noyau. Les plus communs sont côchés. La troisième colonne indique quels opérateurs acceptent le !
préfixe pour inverser leur expression.
Opérateur | Propose | Neg |
---|---|---|
abs | calculate the absolute value of a list of numbers | |
acos | calculate the arccosine value (in radians) of a list of numbers | |
add | treating each input title as a number, add to each the numeric value of the parameter | |
all | find all titles of a fundamental category | |
asin | calculate the arcsine value (in radians) of a list of numbers | |
atan | calculate the arctangent value (in radians) of a list of numbers | |
atan2 | returns the angle in the plane (in radians) between the positive x-axis and the ray from (0,0) to the point (x,y), for [Y ]atan2[X ] |
|
average | treating each input title as a number, compute their arithmetic mean | |
backlinks | find the titles that link to each input title | |
backtranscludes | find the titles that transclude each input title | |
ceil | rounds a list of numbers up to the next largest integer | |
charcode | generates string characters from their numeric character codes | |
contains | filter the input by searching list fields for a value | ! |
cos | calculate the cosine value of a list of angles (given in radians) | |
count | count the number of entries in a list | |
days | filter the input by date | ! |
divide | treating each input title as a number, divide it by the numeric value of the parameter | |
duplicateslugs | find titles that yield duplicate slugs | |
each | select one of each group of input titles by field | |
eachday | select one of each group of input titles by date | |
else | if the list of input titles is empty then return a list consisting of a single constant string, otherwise return the original titles | |
enlist | select titles from the parameter interpreted as a title list | ! |
exponential | convert each number to exponential notation with N digits |
|
field | filter the input by field | ! |
fields | select all field names of the input titles | |
filter | apply a subfilter to each input title and return the titles that return a non-empty result from the subfilter | ! |
fixed | convert each number to fixed point notation with N digits after the decimal point |
|
floor | rounds a list of numbers to the largest integer less than or equal to each number | |
function | apply a function to the input list, and return the result | |
get | select all values of a field in the input titles | |
getindex | select all values of a data property in the input titles | |
has | filter the input by field existence | ! |
haschanged | filter the input by tiddler modification status | ! |
indexes | select all data properties of the input titles | |
is | filter the input by fundamental category | ! |
join | join a list of strings together with the separator S |
|
jsonextract | retrieve the JSON string of a property from JSON strings | |
jsonget | retrieve the value of a property from JSON strings | |
jsonindexes | retrieve the value of a property from JSON strings | |
jsonset | set the value of a property in JSON objects | |
jsontype | retrieve the type of a property from JSON strings | |
length | returns the number of characters of each item in the list | |
links | find the titles linked to by each input title | |
list | select titles via a list field | ! |
listed | find the titles that list the input titles | |
log | treating each input title as a number, return its logarithm with base equal to the numeric value of the parameter if specified, otherwise base e |
|
lookup | applies a prefix to each input title to yield the title of a tiddler from which the final value is retrieved. With a single parameter, the default field is "text" and the default index is "0". If a second parameter is provided, that becomes the target field or index. | |
lowercase | returns each item in the list as lowercase | |
match | returns each item in the list that matches the parameter string | |
max | treating each input title as a number, take the maximum of its value and the numeric value of the parameter | |
maxall | find the largest of a list of numbers | |
median | treating each input title as a number, compute their median value | |
min | treating each input title as a number, take the minimum of its value and the numeric value of the parameter | |
minall | find the smallest of a list of numbers | |
minlength | filter items whose length is greater than or equal to the specified minimum length | |
multiply | treating each input title as a number, multiply it by the numeric value of the parameter | |
negate | calculate the negation of a list of numbers | |
power | treating each input title as a number, raise it to the power of the numeric value of the parameter | |
precision | convert each number to a string with N significant digits |
|
product | produce the product of the input numbers | |
range | generate a range of numbers | ! |
reduce | apply a subfilter to each input title in turn, accumulating a single value | |
regexp | filter the input by pattern-matched field | ! |
remainder | treating each input title as a number, return the remainder when divided by the numeric value of the parameter | |
round | rounds a list of numbers to the nearest integer | |
sameday | filter the input by date | |
search | filter the input by searching tiddler content | ! |
sentencecase | returns each item in the list with the first letter capitalised | |
sign | return -1, 0 or 1 for a list of numbers according to whether each number is negative, zero, or positive | |
sin | calculate the sine value of a list of angles (given in radians) | |
slugify | returns each item in the list in a human-readable form for use in URLs or filenames | |
split | returns each item in the list split into separate strings according to the specified separator S ; duplicates are not removed |
|
splitregexp | returns each item in the list split into separate strings according to the specified regular expression R |
|
standard-deviation | treating each input title as a number, compute their standard-deviation | |
subfilter | select titles from the parameter interpreted as a filter expression | ! |
subtract | treating each input title as a number, subtract from each the numeric value of the parameter | |
sum | produce the sum of the input numbers | |
tan | calculate the tangent value of a list of angles (given in radians) | |
then | replace input titles by a constant string | |
title | select a single title | ! |
titlecase | returns each item in the list with each word capitalised | |
transcludes | find the titles transcluded by each input title | |
trunc | truncates a list of numbers to their integer part, removing any fractional part | |
untrunc | rounds a list of numbers to the next integer with largest absolute value, that is, away from zero | |
uppercase | returns each item in the list as uppercase | |
variance | treating each input title as a number, compute their variance | |
Opérateurs de classement | ||
after | find which input title follows a specified one | |
allafter | discard all items except those after the marker | |
allbefore | discard all items except those before the marker | |
append | append a range of items from an array to the list | |
before | find which input title precedes a specified one | |
bf | same as rest |
|
butfirst | same as rest |
|
butlast | discard the last N input titles |
|
cycle | toggle the titles specified in the first parameter in a cyclical manner | |
first | select the first N input titles |
|
insertafter | insert an item T into a list immediately after an item A |
|
insertbefore | insert an item T into a list immediately before an item B |
|
last | select the last N input titles |
|
limit | select the first or last N input titles |
! |
move | move marker N places in the list | |
next | find which titles in a list field follow the input ones |
|
nsort | sort the input by number field | ! |
nsortcs | sort the input titles by number field, treating upper and lower case as different | ! |
nth | select the N th input title |
|
order | selectively reverse the input list | |
prepend | prepend a range of items from an array to the list | |
previous | find which titles in a list field precede the input ones |
|
putafter | move N trailing items after the marker | |
putbefore | move N trailing items before the marker | |
putfirst | move N trailing items to the head of the list | |
putlast | move N leading items to the tail of the list | |
remove | remove a list of titles specified in the parameter from the input | |
replace | replace marker with N trailing items | |
rest | discard the first N input titles |
|
reverse | reverse the order of the input titles | |
sort | sort the input by text field | ! |
sortan | sort the input by text field considering them as alphanumerics | ! |
sortby | sort the current list in the order of the list referenced in the parameter | |
sortcs | sort the input by text field, treating upper and lower case as different | ! |
sortsub | sort the input by the result of evaluating a subfilter for each item | ! |
toggle | toggle the title specified in the parameter in the input | |
unique | remove all duplicate items from the current list | |
zth | select the Z th input title |
|
Opérateurs de chaine | ||
addprefix | extend each input title with a prefix | |
addsuffix | extend each input title with a suffix | |
applypatches | applies a set of patches to transform the input | |
compare | filter the input by comparing each item against the parameter | ! |
decodebase64 | apply base 64 decoding to a string | |
decodehtml | apply HTML decoding to a string | |
decodeuri | apply URI decoding to a string | |
decodeuricomponent | apply URI component decoding to a string | |
encodebase64 | apply base 64 encoding to a string | |
encodehtml | apply HTML encoding to a string | |
encodeuri | apply URI encoding to a string | |
encodeuricomponent | apply URI component encoding to a string | |
enlist-input | select titles by interpreting each input title as a title list | |
escapecss | apply CSS escaping to a selection of titles through the CSS.escape() method / operation | |
escaperegexp | escape special characters used in regular expressions | |
format | format the input string according to one of supported formats | |
jsonstringify | apply JSON string encoding to a string, see also the similar stringify |
|
levenshtein | determine the Levenshtein distance of the input title(s) and a given string | |
makepatches | returns a set of patches that transform the input to a given string | |
pad | returns each item in the list padded to the specified length | |
prefix | filter the input titles by how they start | ! |
removeprefix | filter the input titles by how they start, deleting that prefix | |
removesuffix | filter the input titles by how they end, deleting that suffix | |
search-replace | returns each item in the list, replacing within each title the string specified by the first parameter with the second parameter | |
sha256 | apply sha256 hash to a string | |
splitbefore | select a delimited prefix from each input title | |
stringify | apply JavaScript string encoding to a string, see also the similar jsonstringify |
|
substitute | returns each item in the list, replacing within each title placeholders for filters, parameters and variables with their corresponding values | |
suffix | filter the input titles by how they end | ! |
trim | returns each item in the list with whitespace, or a given character string, trimmed from the start and/or end | |
Opérateurs de tag | ||
tag | filter the input by tag | ! |
tagging | find the tiddlers that have the input tags | |
tags | select all tags of the input tiddlers | |
untagged | discard any input titles that have tags | ! |
Opérateurs Spéciaux | ||
commands | select the titles of all the Node.js commands | |
deserialize | extract JSON representation of tiddlers from the input strings | |
deserializers | ||
editiondescription | select the descriptions of the input editions | |
editions | select the names of all the TiddlyWiki editions | |
getvariable | select all values of variables named in the input titles | |
modulesproperty | retrieve a module property | |
modules | select the names of all modules of the input module types | |
moduletypes | select the names of all TiddlyWiki module types | |
plugintiddlers | select all shadow titles in the input plugins | |
shadowsource | select the plugin titles that contain the input shadows | |
storyviews | select the names of all the story views | |
subtiddlerfields | select all fields present in the selected tiddlers within a plugin | |
variables | select the names of all the actively defined variables |
La rédaction d'une étape typique s'écrit [opérateur[paramètre]]
, même si tous les opérateurs ne nécessitent pas de paramètre.
La plupart des étapes agissent sur les titres d'une sélection qu'ils ont en entrée, mais quelques uns construisent une sélection entièrement neuve à la place. Pour des règles précises, voir Syntaxe des filtres.