ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

Liquid for Editors

Contents

Tags

child_pages

This tag displays the child pages of a wiki page in an unordered list. It has several options that still need to be described here.

{% child_pages 'Liquid' %}


hello_world

This is an example tag that just displays the words "Hello World!":

{% hello_world %}

Hello world!


include

Use this tag to include another wiki page into the current one. Please see the Liquid documentation for general usage.

{% include 'foo' %}

You can enter the site to include as its title (as in the URL) or with a leading project identifier as in myproject:foo. This will include the page foo from the myproject project.

Variables

tags

The tags variable contains an Array with the names of all tags available in the current scope. You can produce a nice output by piping it into the to_list filter which will turn it into a list for output.

{{ tags | to_list }}

  • assign
  • capture
  • case
  • child_pages
  • comment
  • cycle
  • decrement
  • for
  • hello_world
  • html_comment
  • if
  • ifchanged
  • include
  • increment
  • raw
  • tablerow
  • toc
  • toc_left
  • toc_right
  • unless

variables

The variables variable contains an Array with the names of all variables available in the current scope. You can produce a nice output by piping it into the to_list filter which will turn it into a list for output.

{{ variables | to_list }}

  • content
  • current_user
  • editable
  • macro_list
  • page
  • project
  • tags
  • toc
  • today
  • variables
  • wiki

Filters

Strings of Text

Name Example Usage Example Output Description
size
{{ "text" | size }}
4 Return the size of an array or a string
downcase
{{ "Text" | downcase }}
text Convert an input string to all downcase
upcase
{{ "text" | upcase }}
TEXT Convert an input string to all upcase
default
"" | default: "foo"
foo Returns a default value if the input is not present. Parameters: default_value (required)
capitalize
{{ "my TeXt" | capitalize }}
My text Capitalize the first word of a string
truncate
{{ "This is a long text" | truncate: 7, "..." }}
This... Truncate the string down to x characters. Default parameters: length = 50, truncate_string = "..."
truncatewords
{{ "This is a long text" | truncatewords: 3, "..." }}
This is a... Truncate the string down to x words. Default parameters: words = 15, truncate_string = "..."
split
{{ "This_is_a_long_text" | split: "_" | size }}
5 Splits the input string into an array of substrings separated by the given pattern. Default parameter: pattern = whitespace
strip_newlines
{{ "Some text" | strip_newlines }}
Some text Remove all newlines from the string
replace
{{ "Some long text" | replace: " ", "_" }}
Some_long_text Replace all occurrences of a substring within another. Parameters: search (required), replacement = "" (optional)
replace_first
{{ "Some long text" | replace_first: " ", "_" }}
Some_long text Replace only the first occurrences of a substring within another. Parameters: search (required), replacement = "" (optional)
remove
{{ "Some long text" | remove: " " }}
Somelongtext Remove all occurances of a substring within another string. Parameters: search (required)
remove_first
{{ "Some long text" | remove_first: " " }}
Somelong text Remove only the first occurrences of a substring within another string. Parameters: search (required)
append
{{ "Some long text" | append: " that is long" }}
Some long text that is long Add one string to another. Parameter: string (required)
prepend
{{ "some long text" | prepend: "This is " }}
This is some long text Prepend one string to another. Parameter: string (required)
date
{{ "2011-12-24" | date: "%m/%d/%Y" }}
12/24/2011 Reformats a date. Parameters: format (required). For a documentation of the format strings, please refer to the respective ruby documentation.

Numbers

Name Example Usage Example Output Description
plus
{{ 5 | plus: 3 }}
8 Addition
minus
{{ 5 | minus: 3 }}
2 Subtraction
times
{{ 5 | times: 3 }}
15 Multiplication
divided_by
{{ 6 | divided_by: 3 }}
2 Division

Arrays

Let's first define an array that we are going to use throughout all the examples:

{% assign source = "This text is rather long." %}
Name Example Usage Example Output Description
sort
{{ source | split | sort | join }}
This is long. rather text Sort elements of the array. You can provide an optional property with which to sort an array of hashes or drops.
first
{{ source | split | first }}
This Get the first element of an array. If you pass a numeric parameter, it will return an array containing the last x elements.
last
{{ source | split | last }}
long. Get the last element of an array. If you pass a numeric parameter, it will return an array containing the last x elements.
size
{{ source | split | size }}
5 Return the size of an array or a string
join
{{ source | split | join: "-" }}
This-text-is-rather-long. Join elements of the array with certain character between them. Default parameters: glue = " "
split
{{ "This_is_a_long_text" | split: "_" | size }}
5 Splits the input string into an array of substrings separated by the given pattern. Default parameter: pattern = whitespace
to_list
{{ source | split | to_list }}
* This
* text
* is
* rather
* long.
Format the array as an unordered list. Optional parameters: header_or_depth: If given a string it puts it as a header before the list. If given a numeric parameter it will indent the list to the given level.

Hashes and Drops

Name Example Usage Example Output Description
map Map/collect on a given property. Required parameter: property