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.



39
40
41
# File 'app/lib/liquid/parse_environment.rb', line 39

def initialize(content)
  @content = content
end

Instance Method Details

#render(_context = {}) ⇒ Object



43
44
45
# File 'app/lib/liquid/parse_environment.rb', line 43

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