diff --git a/lib/liquid/tags/inline_comment.rb b/lib/liquid/tags/inline_comment.rb new file mode 100644 index 0000000..e89febc --- /dev/null +++ b/lib/liquid/tags/inline_comment.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Liquid + class InlineComment < Tag + def blank? + true + end + + def render_to_output_buffer(_context, _output) + end + end + + Template.register_tag('#', InlineComment) +end + diff --git a/test/integration/inline_comment_test.rb b/test/integration/inline_comment_test.rb new file mode 100644 index 0000000..ae5b953 --- /dev/null +++ b/test/integration/inline_comment_test.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +require 'test_helper' + +class InlineCommentTest < Minitest::Test + include Liquid + + def test_basic_usage + template_source = <<-END_TEMPLATE + foo{% # this is a comment %}bar + END_TEMPLATE + template = Template.parse(template_source) + rendered = template.render! + assert_equal("foobar", rendered.strip) + end +end +