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

Inline comments throwing lexical parsing exceptions #317

Open
dswitzer opened this issue Feb 27, 2025 · 9 comments · Fixed by #318 · May be fixed by #322
Open

Inline comments throwing lexical parsing exceptions #317

dswitzer opened this issue Feb 27, 2025 · 9 comments · Fixed by #318 · May be fixed by #322

Comments

@dswitzer
Copy link

Are there any plans to support the inline comment styles in newer versions of Liquid?

For example:

{%- # This is a single-line comment -%}

and

{%
  ###############################
  # This is a comment
  # across multiple lines
  ###############################
%}

Currently these styles of comments are throwing lexical parsing exceptions like:

lexer error "token recognition error at: '#'" on line 1, index 7
@bkiers
Copy link
Owner

bkiers commented Feb 27, 2025

I think the linked PR does the trick. However, I've not been really active here lately, so I'll leave the merge (and release) to @msangel

@dswitzer
Copy link
Author

@bkiers,

Amazing! Thanks!

@msangel
Copy link
Collaborator

msangel commented Feb 28, 2025

Released as 0.9.2.0. Maven will take few hours to sync for this library available for all

@bkiers
Copy link
Owner

bkiers commented Feb 28, 2025

Thanks @msangel 👌

@dswitzer
Copy link
Author

Many thanks to you both (@bkiers & @msangel)!!!

I will test this later today.

@dswitzer
Copy link
Author

I finally got a chance to test this, and 0.9.2.0 is still throwing exceptions when processing the following:

{% # for i in (1..3) -%}
{{ i }}
{% # endfor %}

{%
  ###############################
  # This is a comment
  # across multiple lines
  ###############################
%}

According to the documentation (https://shopify.github.io/liquid/tags/template/#inline-comments) this should be allowed.

I've tried both LIQP and LIQUID flavors and get the same error.

It's possible I'm missing something simple in my configuration, but the template parses correct without those styles of comments.

@bkiers
Copy link
Owner

bkiers commented Mar 5, 2025

Just noticed your last comment. I will have a look.

@dswitzer
Copy link
Author

@bkiers,

Just wondering if you had a chance to look at this yet? I really appreciate you taking the time to even submit a PR to include this and can only imagine how busy you are. Thanks!

@bkiers bkiers reopened this Mar 14, 2025
@bkiers
Copy link
Owner

bkiers commented Mar 14, 2025

Ah, I see what is going wrong.

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