Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow spaces around the pipe operator #46

Open
chocolateboy opened this issue Feb 23, 2019 · 1 comment
Open

Allow spaces around the pipe operator #46

chocolateboy opened this issue Feb 23, 2019 · 1 comment

Comments

@chocolateboy
Copy link

chocolateboy commented Feb 23, 2019

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 };
}
@feichao93
Copy link
Owner

feichao93 commented Feb 23, 2019

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 };
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants