Fix Doc tag blank? method to check body content

Previously the blank? method always returned true. Now it properly checks
if the body is empty, making the tag behavior consistent with other tags.

Also updated test to use whitespace control for cleaner assertions.
This commit is contained in:
James Meng
2025-06-09 11:36:18 -07:00
parent 8548b96a97
commit 7b2b25fda1
2 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ module Liquid
end
def blank?
true
@body.empty?
end
def nodelist
+5 -5
View File
@@ -174,11 +174,11 @@ class DocTagUnitTest < Minitest::Test
def test_doc_tag_delimiter_handling
assert_template_result('', <<~LIQUID.chomp)
{% if true %}
{% doc %}
{% docEXTRA %}wut{% enddocEXTRA %}xyz
{% enddoc %}
{% endif %}
{%- if true -%}
{%- doc -%}
{%- docEXTRA -%}wut{% enddocEXTRA -%}xyz
{%- enddoc -%}
{%- endif -%}
LIQUID
assert_template_result('', "{% doc %}123{% enddoc xyz %}")