Class: Liquid::ParseEnvironment::RawFallbackTemplate

Inherits:
Object
  • Object
show all
Defined in:
app/lib/liquid/parse_environment.rb

Overview

Returned when Liquid parsing fails due to an unknown tag or other
syntax error. Strips unparseable {%…%} block tags so they don't
leak into rendered HTML, while preserving all other content.

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ RawFallbackTemplate

Returns a new instance of RawFallbackTemplate.



58
59
60
# File 'app/lib/liquid/parse_environment.rb', line 58

def initialize(content)
  @content = content
end

Instance Method Details

#render(_context = {}) ⇒ Object



62
63
64
# File 'app/lib/liquid/parse_environment.rb', line 62

def render(_context = {})
  @content.gsub(/\{%.*?%\}/m, '')
end