-
Notifications
You must be signed in to change notification settings - Fork 0
RPT Filters
⚠️ ⚠️ THIS WIKI IS BEING USED TO JOT DOWN IDEAS AT PRESENT. DON'T ASSUME ANYTHING IS FIXED.⚠️ ⚠️
⚒️ MORE TO COME: Check back later
The filters listed on this page are unique to rpt, they are not copies of Liquid filters.
Filters that are not yet implemented are marked with a ⛔ symbol.
Filter | Parameters | Input Type | Output Type | Notes |
---|---|---|---|---|
div ⛔ | Int | Int | Int | Returns the input divided by the parameter using integer division. Parameter must not be zero. |
divide ⛔ | Int or Float | Int or Float | Float | Returns the input divided by the parameter floating point division. The parameter must not be zero. |
NOTE:
div
anddivide
are both subtlety different to the Liquiddivided_by
filter.
Filter | Parameters | Input Type | Output Type | Notes |
---|---|---|---|---|
year ⛔ | none | DateTime | Int | Year number. |
month ⛔ | none | DateTime | Int | Month number within year (1..12). |
day ⛔ | none | DateTime | Int | Day of month (1..31). |
hour ⛔ | none | DateTime | Int | Hour of day (1..24). |
minute ⛔ | none | DateTime | Int | Minute of hour (0..59). |
second ⛔ | none | DateTime | Int | Second of minute (0..59). |
millis ⛔ | none | DateTime | Int | Millisecond of minute (0..999). |
day-of-week ⛔ | none | DateTime | Int | Day of week (1..7) per ISO 8601. |
day-of-year ⛔ | none | DateTime | Int | Day of year per ISO 8601. |
week-of-year ⛔ | none | DateTime | Int | Week of year per ISO 8601. |
month-name ⛔ | none | DateTime | Text | Full name of month in current locale. |
month-abbrev ⛔ | none | DateTime | Text | Abbreviated name of month in current locale. |
day-name ⛔ | none | DateTime | Text | Full name of day of week in current locale. |
day-abbrev ⛔ | none | DateTime | Text | Abbreviated name of day of week in current locale. |
iso-datetime ⛔ | Boolean | DateTime | Text | Date and time value in ISO 8601 format. If the parameter is true then date is in UTC format, else date is in local time for the current locale. The UTC form of this function is the DateTime default string. |
am-pm ⛔ | none | DateTime | Text | AM or PM indicator in current locale. |
time-am-pm ⛔ | none | DateTime | Text | Time rendered using 12 hr clock with AM or PM indicator in current locale. |
utc-to-local ⛔ | none | DateTime | DateTime | Converts a DateTime in UTC to a local DateTime in the current locale. |
local-to-utc ⛔ | none | DateTime | DateTime | Converts a local DateTime in the current locale to a DateTime in UTC. |
era ⛔ | none | DateTime | Int | Era number. |
era-name ⛔ | none | DateTime | Text | Full name of era. |
era-abbrev ⛔ | none | DateTime | Text | Abbreviated name of era. |
Filter | Parameters | Input Type | Output Type | Notes |
---|---|---|---|---|
pad-left ⛔ | (x) Int, (y) Text | Text | Text | Pads the input text on the left to a maximum width of (x) characters. The text is padded with text (y), which should normally be a single character. |
pad-right ⛔ | (x) Int, (y) Text | Text | Text | Pads the input text on the right to a maximum width of (x) characters. The text is padded with text (y), which should normally be a single character. |
fmt-float ⛔ | (x) Text | Float | Text | Formats the input float per format string (x). The format string is the same as that used by the Delphi Pascal Format function, except that only the e , f , g , m & n value types may be used. |
fmt-date ⛔ | (x) Text | DateTime | Text | Formats date on input according to format string (x). The format string is the same as that used by the Delphi Pascal DateTimeToString function. |
int-to-hex ⛔ | (x) Int | Int | Text | Converts input Int to hexadecimal format, with the minimum number of digits specified by (x). Values that are shorter than (x) are left padded with zeros. |
Filter | Parameters | Input Type | Output Type | Notes |
---|---|---|---|---|
parse-int ⛔ | none | Textish | Int or Null | Parses the input Text as an integer. If the conversion fails then Null is returned. |
parse-float ⛔ | none | Text or Int | Float or Null | Parses the input as a floating point value. Text input is converted a float if possible, otherwise Null is returned. Int values always converted. |
parse-date ⛔ | none | Textish | DateTime or Null | Parses the input Text as a DateTime value. If the conversion fails then Null is returned. |
parse-bool ⛔ | none | Any | Boolean | Parses the input as a Boolean value. Always returns the truthiness value as defined for the input type. |
int-to-float ⛔ | none | Int | Float | Converts the input Int to a Float. |
hex-to-int ⛔ | none | Text | Int or Null | Converts the input hexadecimal Text into an integer. If the conversion fails then Null is returned. |
to-string ⛔ | none | Any | Text | Converts any type to Text in the default format for the type. |
to-file ⛔ | none | Text | File or Null | Converts the input Text value to a File object, providing the input is a valid file path. Null is returned otherwise. |
to-dir ⛔ | none | Text | Directory or Null | Converts the input Text value to a Directory object, providing the input is a valid directory path. Null is returned otherwise. |
is-null ⛔ | none | Any | Boolean | Checks if the type of the input is Null and returns @true if so and @false if not. |
is-int ⛔ | none | Any | Boolean | Checks if the type of the input is Int and returns @true if so and @false if not. |
is-float ⛔ | none | Any | Boolean | Checks if the type of the input is Float and returns @true if so and @false if not. |
is-numeric ⛔ | none | Any | Boolean | Checks if the type of the input is Numeric (i.e. Int or Float) and returns @true if so and @false if not. |
is-datetime ⛔ | none | Any | Boolean | Checks if the type of the input is DateTime and returns @true if so and @false if not. |
is-boolean ⛔ | none | Any | Boolean | Checks if the type of the input is Boolean and returns @true if so and @false if not. |
is-text ⛔ | none | Any | Boolean | Checks if the type of the input is Text and returns @true if so and @false if not. |
is-file ⛔ | none | Any | Boolean | Checks if the type of the input is File and returns @true if so and @false if not. |
is-directory ⛔ | none | Any | Boolean | Checks if the type of the input is Directory and returns @true if so and @false if not. |
is-url ⛔ | none | Any | Boolean | Checks if the type of the input is URL and returns @true if so and @false if not. |
is-array ⛔ | none | Any | Boolean | Checks if the type of the input is Array and returns @true if so and @false if not. |
is-os ⛔ | none | Any | Boolean | Checks if the type of the input is OS and returns @true if so and @false if not. |
is-empty ⛔ | none | Text, Boolean & Null | Boolean | Checks if the input is empty. Returns @true if Text input is an empty string, if Boolean input is a @false or if input is Null, otherwise returns @false . |
Filter | Parameters | Input Type | Output Type | Notes |
---|---|---|---|---|
c-to-f ⛔ | none | Int or Float | Float | Converts the input number from degrees Centigrade to degrees Fahrenheit. |
f-to-c ⛔ | none | Int or Float | Float | Converts the input number from degrees Fahrenheit to degrees Centigrade. |
c-to-k ⛔ | none | Int or Float | Float or Null | Converts the input number from degrees Centigrade to Kelvin. If the input value is less than -273.15℃ then Null is returned. |
k-to-c ⛔ | none | Int or Float | Float or Null | Converts the input number from Kelvin to degrees Centigrade. If the input value is less than 0K then Null is returned. |
File filters all take a File object as input. They are:
Filter | Parameters | Input Type | Output Type | Notes |
---|---|---|---|---|
file-name ⛔ | none | File | Text | File name without path. |
file-path ⛔ | none | File | Text | Full path to file. This is the File default text. |
file-dir ⛔ | none | File | Directory | Directory containing file. |
file-ext ⛔ | none | File | Text | File extension, if any. |
file-base-name ⛔ | none | File | Text | File name without path or extension. |
file-mod-date ⛔ | none | File | DateTime | Date & time file was last modified. |
file-create-date ⛔ | none | File | DateTime | Date & time file was created. |
file-access-date ⛔ | none | File | DateTime | Date & time file was last accessed. |
Directory filters all take a Directory object as input. They are:
Filter | Parameters | Input Type | Output Type | Notes |
---|---|---|---|---|
dir-name ⛔ | none | Directory | Text | Name of directory without path. |
dir-path ⛔ | none | Directory | Text | Full path to directory. This is the Directory default text. |
dir-parent ⛔ | none | Directory | Directory | Directory's parent directory. Null if directory has no parent. |
dir-mod-date ⛔ | none | Directory | Date | Date & time directory was last modified. |
dir-create-date ⛔ | none | Directory | Date | Date & time directory was created. |
dir-access-date ⛔ | none | Directory | Date | Date & time directory was last accessed. |
Filter | Parameters | Input Type | Output Type | Notes |
---|---|---|---|---|
if ⛔ | (a) Any, (b) Any | Any | Any | If filter input is truthy then (a) is copied to output else (b) is copied to output. Type of output is the same as that of copied parameter. |
not ⛔ | none | Any | Boolean | Inverts the logical value of the input. If input is truthy then @false is returned or if the input is falsey then @true is returned. |
and ⛔ | Any | Any | Boolean | Performs a logical and operation on the truthiness of the input and the parameter and returns it. |
or ⛔ | Any | Any | Boolean | Performs a logical or operation on the truthiness of the input and the parameter and returns it. |
xor ⛔ | Any | Any | Boolean | Performs a logical xor operation on the truthiness of the input and the parameter and returns it. |
eq ⛔ | Text | Text | Boolean | Performs a case sensitive comparison of the input text with the text parameter and returns @true if they are equal or @false if not. |
eq ⛔ | Numeric | Numeric | Boolean | Compares the input Text with the parameter and returns @true if they are equal or @false if not. If the input is Int and the parameter is Float, or vice versa, then the Int value is converted to a Float first. |
eq ⛔ | Boolean | Boolean | Boolean | Compares the input Boolean with the parameter and returns @true if they are equal or @false if not. |
eq ⛔ | DateTime | DateTime | Boolean | Compares the input DateTime with the parameter and returns @true if they are equal or @false if not. |
neq ⛔ | Text, Numeric, Boolean & DateTime | Text, Numeric, Boolean & DateTime | Boolean | Similar to eq for each of the given types except that @false is returned when the input equals the parameter and @true if not. |
lt ⛔ | Text, Numeric, & DateTime | Text, Numeric & DateTime | Boolean | Similar to eq for each of the given types except that @true is returned when the input is less than the parameter and @false if not. |
lte ⛔ | Text, Numeric, & DateTime | Text, Numeric & DateTime | Boolean | Similar to eq for each of the given types except that @true is returned when the input is less than or equal to the parameter and @false if not. |
gt ⛔ | Text, Numeric, & DateTime | Text, Numeric & DateTime | Boolean | Similar to eq for each of the given types except that @true is returned when the input is greater than the parameter and @false if not. |
gte ⛔ | Text, Numeric, & DateTime | Text, Numeric & DateTime | Boolean | Similar to eq for each of the given types except that @true is returned when the input is greater than or equal to the parameter and @false if not. |
eq-text ⛔ | Text | Text | Boolean | Performs a case insensitive comparison of the input text with the text parameter and returns @true if they are equal or @false if not. |
neq-text ⛔ | Text | Text | Boolean | Performs a case insensitive comparison of the input text with the text parameter and returns @false if they are equal or @true if not. |
⛔ Sets the value of the variable named in the parameter to the value of the filter's input & returns the same value.
If the variable does not exist it is created, otherwise any existing value is overwritten.
The variable name must have a valid name. It must have Text type, for example a quoted string. If an actual, unquoted, variable name is specified then the value, not the name, of that variable will be used as the variable name. Be careful!
To prevent the variable's value from being returned from the placeholder pipe the value to a sink
filter.
Parameter: Name of variable, type Text
Input type: anything
Output type: same as input type
Examples:
{{ "Lorem ipsum dolor" > set-var < "foo" > sink }}
Sets variable foo
to have value "Lorem ipsum dolor" and returns Null from the placeholder.
{{ "Duis volutpat sapien" > set-var < foo }}
Assuming variable foo
has value "bar" then the above placeholder sets the variable bar
(not foo
) to "Duis volutpat sapien". This time the placeholder also returns "Duis volutpat sapien".
{{ "FA42" > hex-to-int > set-var < "foo" }}
Here set-var
gets an Int value from the preceding filter and stores it in variable foo
, which will then have type Int. The value is also returned from the placeholder.
⛔ Swallows all its input and returns Null. Aimed for use with some special filters that create side affects where no output is required.
Input type: anything
Output type: null