Class: Liquid::InlineComment

Inherits:
Tag
  • Object
show all
Defined in:
lib/liquid/tags/inline_comment.rb

Instance Attribute Summary

Attributes inherited from Tag

#line_number, #nodelist, #parse_context, #tag_name

Instance Method Summary collapse

Methods inherited from Tag

disable_tags, #name, parse, #parse, #raw, #render

Methods included from ParserSwitching

#parse_with_selected_parser, #strict_parse_with_error_mode_fallback

Constructor Details

#initialize(tag_name, markup, options) ⇒ InlineComment

Returns a new instance of InlineComment.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/liquid/tags/inline_comment.rb', line 5

def initialize(tag_name, markup, options)
  super

  # Semantically, a comment should only ignore everything after it on the line.
  # Currently, this implementation doesn't support mixing a comment with another tag
  # but we need to reserve future support for this and prevent the introduction
  # of inline comments from being backward incompatible change.
  #
  # As such, we're forcing users to put a # symbol on every line otherwise this
  # tag will throw an error.
  if markup.match?(/\n\s*[^#\s]/)
    raise SyntaxError, options[:locale].t("errors.syntax.inline_comment_invalid")
  end
end

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/liquid/tags/inline_comment.rb', line 24

def blank?
  true
end

#render_to_output_buffer(_context, output) ⇒ Object



20
21
22
# File 'lib/liquid/tags/inline_comment.rb', line 20

def render_to_output_buffer(_context, output)
  output
end