temme icon indicating copy to clipboard operation
temme copied to clipboard

Allow spaces around the pipe operator

Open chocolateboy opened this issue 6 years ago • 1 comments

Please allow spaces to be used around the pipe operator (|). They make filters much easier to read.

Before:

div.movies@ {
    .title { $title };
    .date { $date };
    .duration { $duration|match("\\d+")|get(0)|Number };
}

After:

div.movies@ {
    .title { $title };
    .date { $date };
    .duration { $duration | match("\\d+") | get(0) | Number };
}

chocolateboy avatar Feb 23 '19 04:02 chocolateboy

Nice idea. I'll investigate it in recent days.

For now, you may use a customized filter to enhance the readability 😄

filter getFirstNumber() {
  return Number(this.match("\\d+")[0])
}

div.movies@ {
    .title { $title };
    .date { $date };
    .duration { $duration|getFirstNumber };
}

feichao93 avatar Feb 23 '19 14:02 feichao93