ComboStrap UI - Pipeline
About
A pipeline is a serie of function that may transform a variable value
Syntax
${variable | function | function | ... }
where:
- variable is a variable
- function is one of:
Functions
Capitalize
capitalize is a function that will make the first letter of each word an uppercase letter (ie capital letter)
Syntax:
capitalize()
Example:
${description | capitalize()}
Output:
A Pipeline Permits To Transform A Variable Value With A Succession Of Transformation Function.
Cut
cut is a function that will split the string in parts and returned the asked part concatenated. If the separator is not found, the original string is returned
Syntax:
cut("separator",selector)
where:
- separator can be a simple character or a regular expression.
- selector is a token selection in the form x[-y] where:
- x is the first token to select
- - will select also the next tokens (optional, if not set only one token is returned)
- y is the last token to select (optional, by default, the last one)
Example:
- Range Token Selection. Select all token after the number 10
${description | cut(" ","10-")}
Output:
a succession of transformation function.
- Single Token Selection. Select only the second token
${description | cut(" ",2)}
Output:
pipeline
- If the separator is not found, the function has not effect on the given string.
${title | cut("-",2)}
Output:
ComboStrap Pipeline
Head
head is a function that will extract the first words that are in the maximal length specified.
Syntax:
head($length, $tail)
where:
- length is the maximal length of the output string
- tail is an optional string that is added if the input string was cut
For instance:
${description | head(20 , "...")}
Output:
A pipeline permits to...
Rconcat
rconcat is a function that will concatenate a string to the right. It's deprecated for the tail argument of the head function.
Syntax:
rconcat($string)
For instance:
${description | head(20) | rconcat("...")}
Output:
A pipeline permits to...
Replace
replace is a function that will search a string and replace it.
Syntax:
replace($search, $replace)
For instance:
${title | replace("Pipeline","Pipe-line")}
Output:
ComboStrap Pipe-line
Trim
trim is a function that strip whitespace from the beginning and end of a string
Syntax:
trim()
For instance:
${title | trim()}
Output:
ComboStrap Pipeline
Format
The format function permits to format a date.
Syntax:
format(pattern, locale)
where:
- locale is a locale (region and language)
- pattern is an optional
- or two normal name separated by a space normalNameForDate normalNameForTime
The normal names produce a normal date format for the country (region). The supported normal names are:
Name | Date | Time |
---|---|---|
short | 12/13/52 | 3:30pm |
medium | Jan. 12, 1952 | |
long | January 12, 1952 | 3:30:32pm |
full | Tuesday, April 12, 1952 | 3:30:42pm PST |
For instance:
- Default
${now | format()}
Saturday, November 9, 2024
- With normal name format
${now | format('full short')}
Saturday, November 9, 2024 at 12:03 AM
- With an iso pattern
${now | format('mmm dd yyyy')}
003 09 2024
For more example, see the dedicated date page