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

Slice filter ignores negative bounds #263

Closed
gbts opened this issue Apr 9, 2021 · 0 comments
Closed

Slice filter ignores negative bounds #263

gbts opened this issue Apr 9, 2021 · 0 comments

Comments

@gbts
Copy link
Contributor

gbts commented Apr 9, 2021

e.g. the expected output of {{ "mystring1" | slice:":-1"}} would be mystring, but instead it's just mystring1

gbts added a commit to gbts/pongo2 that referenced this issue Apr 9, 2021
Related to issue flosch#263, I ended up using a custom filter in my own template that just adds an extra branch in filterSlice to calculate & check the negative to bound
flosch pushed a commit that referenced this issue Dec 10, 2021
* Adds support for negative to bound in slice filter

Related to issue #263, I ended up using a custom filter in my own template that just adds an extra branch in filterSlice to calculate & check the negative to bound

* Slightly more readable version of the bounds check (hopefully)

* Adds tests, better handling of negative bounds for the slice filter

* Handle whitespace in slice end boundary
@flosch flosch closed this as completed Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants