Class: Liquid2::RawTag

Inherits:
Tag show all
Defined in:
lib/liquid2/nodes/tags/raw.rb

Overview

The standard raw tag.

Instance Attribute Summary

Attributes inherited from Node

#blank, #token

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Tag

#name

Methods inherited from Node

#block_scope, #children, #expressions, #partial_scope, #render_with_disabled_tag_check, #template_scope

Constructor Details

#initialize(token, text) ⇒ RawTag

Returns a new instance of RawTag.

Parameters:

  • text (String)


21
22
23
24
25
# File 'lib/liquid2/nodes/tags/raw.rb', line 21

def initialize(token, text)
  super(token)
  @text = text
  @blank = false
end

Class Method Details

.parse(token, parser) ⇒ RawTag

Parameters:

Returns:



10
11
12
13
14
15
16
17
18
# File 'lib/liquid2/nodes/tags/raw.rb', line 10

def self.parse(token, parser)
  parser.carry_whitespace_control
  parser.eat(:token_tag_end)
  # TODO: apply whitespace control to raw text?
  # Shopify/liquid does not apply whitespace control to raw content.
  raw = parser.eat(:token_raw)
  parser.eat_empty_tag("endraw")
  new(token, raw[1] || raise)
end

Instance Method Details

#render(_context, buffer) ⇒ Object



27
28
29
# File 'lib/liquid2/nodes/tags/raw.rb', line 27

def render(_context, buffer)
  buffer << @text
end