ComboStrap Pipeline

Undraw Building Websites I78t

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:
    • 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:

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 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()}

Thursday, March 28, 2024

  • With normal name format
${now | format('full short')}

Thursday, March 28, 2024 at 5:49 PM

  • With an iso pattern
${now | format('mmm dd yyyy')}

049 28 2024

For more example, see the dedicated date page




Showcase yourself and your brand

Get free news, tips, and tricks
to create a remarkable experience for your readers.




Related HowTo's
How to format a date ?

This page shows you how to format a date.
Undraw Animating
How to generate and layout a list of pages with a grid and their image?

This howto shows you how to use the page sql, a fragment, the iterator and to generate a grid layout.


Recommended Pages
Page Explorer List Name To Ui Region
Page-explorer: adding page navigation easily to your website

With the page-explorer component, you can add an explorer like panel that will list your pages in a list or collapsible tree fashion
Undraw Building Websites I78t
Simple Templating markup

Simple templating markup are markups that you can use inside the content of your page: to show information your pages or to show a list of pages Templating offers the following components: ...
Undraw Building Websites I78t
The variables that can be used anywhere

This page describes which variables you can use in your content.



Task Runner