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

Unexpected Range Behavior With Spaces #791

Closed
microalps opened this issue Jan 14, 2025 · 4 comments
Closed

Unexpected Range Behavior With Spaces #791

microalps opened this issue Jan 14, 2025 · 4 comments
Labels

Comments

@microalps
Copy link

microalps commented Jan 14, 2025

This was found while investigating dotliquid/dotliquid#565

Spaces are not accepted consistently.

Template Status
{{(1.. 5}} Works
{{(1 . 5}} Works (unexpectedly)
{{(1 ..5}} Doesn't Work (Empty)
{{(1..5 )}} Exception
{{( num.one .. num.five)}} Works
{{( num.one .. num.five )}} Exception
@harttle harttle added the bug label Jan 19, 2025
@harttle
Copy link
Owner

harttle commented Jan 19, 2025

I checked shopify/liquid, it seems don't allow any spaces, otherwise will be interpreted as literal string, like "{{(1 . 5}}".

github-actions bot pushed a commit that referenced this issue Jan 19, 2025
## [10.20.2](v10.20.1...v10.20.2) (2025-01-19)

### Bug Fixes

* consistent range syntax parsing, [#791](#791) ([a490a70](a490a70))
* context for group_by_exp/where_exp/find_exp, [#790](#790) ([a5070af](a5070af))
@harttle
Copy link
Owner

harttle commented Jan 19, 2025

I make invalid uses like {{(1. 5)}} or {{(1..5}} to throw in the 10.20.2, and for backward compatibility spaces are still allowed, before or after numbers.

@harttle harttle closed this as completed Jan 19, 2025
@harttle
Copy link
Owner

harttle commented Jan 19, 2025

Thank you for reporting @microalps, happy to find another Liquid enthusiast!

@microalps
Copy link
Author

I checked shopify/liquid, it seems don't allow any spaces, otherwise will be interpreted as literal string, like "{{(1 . 5}}".

See my tests on https://replit.com/@microalps/LiquidUnitTests#main.rb - it depends if strict mode is on, which allows spaces or lax mode which doesn't. I know, it's a misnomer.

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

No branches or pull requests

2 participants