ruby-on-railshamlliquidlocomotivecms

Locomotive Liquid::SyntaxError at / Tag '{%' was not properly terminated with regexp: /\%\}/


I'm using HAML with Locomotive CMS's liquid templates. Recently, I received the following error:

Liquid::SyntaxError at /
Tag '{%' was not properly terminated with regexp: /\%\}/

I'm using a block tag to add classes to a li by overriding it from child template files. FYI, I'm using Liquid Inheritance which is included into Locomotive's Liquid fork.

%li.menu-list-item{:class => "{% block 'at_about_page' %}{% endblock %}"}

Solution

  • Turns out I couldn't have both a .class in HAML format and also specify a {:class => ""} tag block.

    Moving menu-list-item into the class attribute defined afterward works:

    %li{:class => "menu-list-item {% block 'at_about_page' %}{% endblock %}"}