rocket_dyn_templates::minijinja::filters

Function indent

Source
pub fn indent(
    value: String,
    width: usize,
    indent_first_line: Option<bool>,
    indent_blank_lines: Option<bool>,
) -> String
Expand description

Indents Value with spaces

The first optional parameter to the filter can be set to true to indent the first line. The parameter defaults to false. the second optional parameter to the filter can be set to true to indent blank lines. The parameter defaults to false. This filter is useful, if you want to template yaml-files

example:
  config:
{{ global_conifg|indent(2) }}          # does not indent first line
{{ global_config|indent(2,true) }}     # indent whole Value with two spaces
{{ global_config|indent(2,true,true)}} # indent whole Value and all blank lines