Class: Liquid::Raw

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

Constant Summary collapse

Syntax =
/\A\s*\z/
FullTokenPossiblyInvalid =
/\A(.*)#{TagStart}\s*(\w+)\s*(.*)?#{TagEnd}\z/om

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.



8
9
10
11
12
# File 'lib/liquid/tags/raw.rb', line 8

def initialize(tag_name, markup, parse_context)
  super

  ensure_valid_markup(tag_name, markup, parse_context)
end

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/liquid/tags/raw.rb', line 36

def blank?
  @body.empty?
end

#nodelistObject



32
33
34
# File 'lib/liquid/tags/raw.rb', line 32

def nodelist
  [@body]
end

#parse(tokens) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/liquid/tags/raw.rb', line 14

def parse(tokens)
  @body = +''
  while (token = tokens.shift)
    if token =~ FullTokenPossiblyInvalid && block_delimiter == Regexp.last_match(2)
      @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



27
28
29
30
# File 'lib/liquid/tags/raw.rb', line 27

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