---json { "description": "A pipeline permits to transform a variable value with a succession of transformation function.", "page_id": "x8speed0rna8y7lqsocge", "title": "ComboStrap Pipeline" } --- ====== ComboStrap UI - Pipeline ====== ===== About ===== A ''pipeline'' is a serie of function that may transform a [[docs:templating:variable|variable value]] ===== Syntax ===== ${variable | function | function | ... } where: * ''variable'' is a [[:docs:templating:variable|variable]] * ''function'' is one of: * [[#capitalize]] - make the first letter of each word a capital letter (ie uppercase letter) * [[#cut]] - cut the string in parts and return one * [[#head]] - return the first words * [[#replace]] - replace a string * [[#rconcat]] - add a string at the right side * [[#trim]] - delete any space before and after * [[#format]] - format a date ===== 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: ==== 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: * Single Token Selection. Select only the second token ${description | cut(" ",2)} Output: * If the separator is not found, the function has not effect on the given string. ${title | cut("-",2)} Output: ==== 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: ==== 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: ==== 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: ==== Trim ==== ''trim'' is a function that strip whitespace from the beginning and end of a string **Syntax**: trim() For instance: ${title | trim()} Output: ==== Format ==== The format function permits to format a date. **Syntax**: format(pattern, locale) where: * ''locale'' is a [[:docs:locale:locale|locale]] (region and language) * ''pattern'' is an optional * [[https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax|ISO date pattern]] * or two ''normal name'' separated by a space ''normalNameForDate normalNameForTime'' The ''normal names'' produce a normal date format for the [[:docs:locale:region|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()} * With normal name format ${now | format('full short')} * With an iso pattern ${now | format('mmm dd yyyy')} For more example, see [[howto:date|the dedicated date page]]