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.



37
38
39
# File 'app/lib/liquid/parse_environment.rb', line 37

def initialize(content)
  @content = content
end

Instance Method Details

#render(_context = {}) ⇒ Object



41
42
43
# File 'app/lib/liquid/parse_environment.rb', line 41

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