Closed amit777 closed 5 months ago
I would have expected the parser to throw an error with this template about the {% else if invalid %}
I drafted a PR that throws an error in the else if
case, but I just noticed that Shopify isn't throwing an error in the same case. They just parse the 'invalid' else if...
as an else
and ignore following conditions:
Should we be seeking to replicate the behaviour of the Ruby library here, or is throwing a parse error desired?
Though we don't replicate many of error scenarios in Shopify, consistency is always good. I think we can leave it as it is, as it's already consistent with Shopify.
Agreed that throwing an error isn't desired, I'll close the draft PR.
I think the real issue is that liquidjs is rendering multiple else
blocks in the same conditional statement. I opened #670
I noticed this liquid syntax is getting parsed correctly when it shouldn't (notice the space between
else
andif
inelse if invalid
:It renders