Skip to content

Commit dae47e3

Browse files
charlespwdclaude
andcommitted
Derive block_form? from @Body presence instead of tracking separately
@Body is only set in reparent_as_block, so it already encodes whether the tag is in block form. Remove the redundant @block_form flag. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent afed2f2 commit dae47e3

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

History.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Liquid Change Log
22

3+
## 5.12.0
4+
* Introduce HybridTag base class for tags that can be self-closing or block-form, with end-tag-triggered reparenting in BlockBody [CP Clermont]
5+
36
## 5.11.0
47
* Revert the Inline Snippets tag (#2001), treat its inclusion in the latest Liquid release as a bug, and allow for feedback on RFC#1916 to better support Liquid developers [Guilherme Carreiro]
58
* Rename the `:rigid` error mode to `:strict2` and display a warning when users attempt to use the `:rigid` mode [Guilherme Carreiro]

lib/liquid/hybrid_tag.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@
33
module Liquid
44
class HybridTag < Block
55
def reparent_as_block(children, parse_context)
6-
@block_form = true
76
@body = new_body
87
@body.nodelist.concat(children)
98
@body.freeze
109
end
1110

1211
def parse(_tokens)
13-
@block_form = false
1412
end
1513

1614
def block_form?
17-
@block_form
15+
!!@body
1816
end
1917

2018
def nodelist
@@ -26,7 +24,7 @@ def blank?
2624
end
2725

2826
def render_to_output_buffer(context, output)
29-
if @block_form
27+
if block_form?
3028
render_block_form_to_output_buffer(context, output)
3129
else
3230
render_self_closing_to_output_buffer(context, output)

0 commit comments

Comments
 (0)