elsif tag syntax highlighting issue

Shopify Partner
67 0 7

While editing themes using the 'Edit HTML/CSS' option, the elsif control flow tag has a syntax highlighting issue.

For example, 

{% if product.tags contains "Shirt" %}
  -- do something --
{% elsif product.tags contains "TShirt" %}
  -- do this --
{% else %}
  -- dont do anything --
{% endif %}


is higlighted like so:

{% if product.tags contains "Shirt" %}
  -- do something --
{% elsif product.tags contains "TShirt" %}
  -- do this --
{% else %}
  -- dont do anything --
{% endif %}

notice the lack of formatting after **elsif**. This is purely a cosmetic issue ( perhaps with just that editor ) as the block is fully functional as expected.

AM

0 Likes
New Member
3 0 0

still a thing...

0 Likes

Nearly 2020 and still a thing, and no answer whatsoever, altough in my case this is NOT functional at all. There is another post on that topic too.

 

Example:

 

ak9l33qLkc.png

In that case the elsif condition is not working, I have to create multiple if statments. Am I doing something wrong or does it simply not work and noone at Shopify bother to answer?

I think it would be valuable to the community to bring some sort of answer, the other topic is also not solved : https://community.shopify.com/c/Shopify-Design/Liquid-elsif-and-and-conditionals-not-working/m-p/144... 

C'est simple comme bonjour ! Ou presque.
Need some help to customize your website? Message me anytime: 5euros.com/profil/maxdesign
0 Likes
Shopify Expert
2686 67 681

@MaxDesign there must be something else, since I use elsif every day and it works the way I expect it too.

Could it be that your Lavage contains both strings? Does case match?

I personally hate to match string like these -- there is always space for errors -- wrong can, extra space and no match.

 

Though I would be happy if Shopify updates the editor to better syntax highlighting.

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
1 Like

Thanks Tim, after further verification it was only a highlighting issue indeed, but the highlighting issue also made me think the liquid was not working as expected, so I did not troubleshot as I should have. I guess you are right on that too, better not use long strings like these, I see some tag filters like handleize can be very handy in this situation.

C'est simple comme bonjour ! Ou presque.
Need some help to customize your website? Message me anytime: 5euros.com/profil/maxdesign
0 Likes