mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-03 00:55:11 -07:00
Add inline comments syntax
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
@@ -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
|
||||||
|
|
||||||
Reference in New Issue
Block a user