trim_blocks

Function trim_blocks 

Source
pub fn trim_blocks(string: &str) -> String
Expand description

Normalizes linebreaks by replacing three or more consecutive linebreaks with two consecutive linebreaks while leaving a single trailing linebreak.

NOTE: This is a temporary solution that naively mimicks what tera would do if/when it adds trim_blocks. It is by no means smart and will just normalize whitespace regardless of what the template requested.

ยงArguments

  • string - The string to normalize.