Class: Liquid::Raw

Inherits:
Block show all
Defined in:
lib/liquid/tags/raw.rb

Constant Summary collapse

Syntax =
/\A\s*\z/

Constants inherited from Block

Block::MAX_DEPTH

Instance Attribute Summary

Attributes inherited from Tag

#line_number, #parse_context, #tag_name

Instance Method Summary collapse

Methods inherited from Block

#block_delimiter, #block_name, #raise_tag_never_closed, raise_unknown_tag, #render, #unknown_tag

Methods inherited from Tag

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

Methods included from ParserSwitching

#parse_with_selected_parser, #strict_parse_with_error_mode_fallback

Constructor Details

#initialize(tag_name, markup, parse_context) ⇒ Raw

Returns a new instance of Raw.



18
19
20
21
22
# File 'lib/liquid/tags/raw.rb', line 18

def initialize(tag_name, markup, parse_context)
  super

  ensure_valid_markup(tag_name, markup, parse_context)
end

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/liquid/tags/raw.rb', line 47

def blank?
  @body.empty?
end

#nodelistObject



43
44
45
# File 'lib/liquid/tags/raw.rb', line 43

def nodelist
  [@body]
end

#parse(tokens) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/liquid/tags/raw.rb', line 24

def parse(tokens)
  @body = +''
  while (token = tokens.shift)
    if token =~ BlockBody::FullTokenPossiblyInvalid && block_delimiter == Regexp.last_match(2)
      parse_context.trim_whitespace = (token[-3] == WhitespaceControl)
      @body << Regexp.last_match(1) if Regexp.last_match(1) != ""
      return
    end
    @body << token unless token.empty?
  end

  raise_tag_never_closed(block_name)
end

#render_to_output_buffer(_context, output) ⇒ Object



38
39
40
41
# File 'lib/liquid/tags/raw.rb', line 38

def render_to_output_buffer(_context, output)
  output << @body
  output
end