Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/liquid/block_body.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def freeze
markup = Regexp.last_match(2)

if tag_name == 'liquid'
parse_context.line_number -= 1
parse_context.line_number -= 1 if parse_context.line_number
next parse_liquid_tag(markup, parse_context)
end

Expand Down
6 changes: 6 additions & 0 deletions test/integration/tags/liquid_tag_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,10 @@ def test_next_liquid_with_unclosed_if_tag
-%}
LIQUID
end

def test_nested_liquid_tags_do_not_raise_NoMethodError_when_line_numbers_is_false
assert_template_result('good', <<~LIQUID, line_numbers: false)
{% liquid liquid echo "good" %}
LIQUID
end
end
4 changes: 2 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ module Assertions
def assert_template_result(
expected, template, assigns = {},
message: nil, partials: nil, error_mode: Liquid::Environment.default.error_mode, render_errors: false,
template_factory: nil
template_factory: nil, line_numbers: true
)
file_system = StubFileSystem.new(partials || {})
environment = Liquid::Environment.build(file_system: file_system)
template = Liquid::Template.parse(template, line_numbers: true, error_mode: error_mode&.to_sym, environment: environment)
template = Liquid::Template.parse(template, line_numbers: line_numbers, error_mode: error_mode&.to_sym, environment: environment)
registers = Liquid::Registers.new(file_system: file_system, template_factory: template_factory)
context = Liquid::Context.build(static_environments: assigns, rethrow_errors: !render_errors, registers: registers, environment: environment)
output = template.render(context)
Expand Down
Loading