Shopify / liquid

Liquid markup language. Safe, customer facing template language for flexible web apps.
https://shopify.github.io/liquid/
MIT License
11.05k stars 1.38k forks source link

Allow liquid tag inside liquid tag #1731

Closed Maaarcocr closed 1 year ago

Maaarcocr commented 1 year ago

why?

matches liquid-c behaviour

how?

~just skip the liquid tag if it's inside a liquid tag, it essentially does not change any behaviour as far as I can see.~

EDIT: matching the actual liquid-c behaviour we now recursively parse the markup for liquid tags inside liquid tags. I have to decrease the line number by 1 because when tokenizing in liquid tag mode we always up line number by one, but really in this case we are staying in the same line.

gmalette commented 1 year ago

How confident are you that this is what liquid-c does?

jg-rp commented 1 year ago

Hi. As is, this PR would fail the following test case, but pass with liquid-c.

def test_inline_liquid_tag_in_liquid_tag
    assert_template_result('42', <<~LIQUID)
      {%- liquid
        liquid echo 42
      -%}
    LIQUID
  end