Learning Liquid - Shopify(此代码部分的问题在哪里)

Learning Liquid - Shopify (where is issue on this code section)

我正在学习液态语言,并使用可视化代码编辑器,我正在遵循有关编写的规则,但目前它向我展示了有关此部分代码的一些问题,它是关于“液态语法错误(第 18 行)”: 'for' 标签从未关闭

谁能告诉我在哪里可以解决这个问题?

<div class="page-width">
  <div class="custom-content section-block">
    {%- liquid
   for block in section.blocks 
     case block.settings.width 
      when '25%'
        assign block_width = 'small--one-whole one-quarter' 
      when '33%'
        assign block_width = 'small--one-whole one-third'
      when '50%'
        assign block_width = 'small--one-whole one-half'
      when '66%'
        assign block_width = 'small--one-whole two-thirds' 
      when '75%'
         assign block_width = 'small--one-whole three-quarters'
       when '100%' 
         assign block_width = 'one-whole' 
    endcase -%}
    <div id="section-block-returns" class="section-block--padding grid__item {{ block_width }} {% if block.settings.alignment %}align--{{ block.settings.alignment }}{% endif %}" {{ block.shopify_attributes }}>
      <div class="grid__item-inner grid__item-inner--{{ block.type }}">
        <div class="rte">
          {{ block.settings.code }}
        </div>
      </div>
    </div>
  {% endfor %}
  </div>
</div>

您忘记使用结束标记 'endfor' 结束 'for loop',请将其放在 'endcase' 结束标记之后。像这样:

{%- liquid
 for block in section.blocks 
   case block.settings.width 
    when '25%'
      assign block_width = 'small--one-whole one-quarter' 
    when '33%'
      assign block_width = 'small--one-whole one-third'
    when '50%'
      assign block_width = 'small--one-whole one-half'
    when '66%'
      assign block_width = 'small--one-whole two-thirds' 
    when '75%'
       assign block_width = 'small--one-whole three-quarters'
     when '100%' 
       assign block_width = 'one-whole' 
    endcase 
  endfor -%}

希望它现在能正常工作