Sha256: f5cc9d75ac4601492989c980bd82f9717dd1e3636661baa432fcf6d44e76e228
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
module Liquid class Tag attr_accessor :nodelist, :options, :line attr_reader :warnings def self.new_with_options(tag_name, markup, tokens, options) # Forgive me Matz for I have sinned. I know this code is weird # but it was necessary to maintain API compatibility. new_tag = self.allocate new_tag.options = options new_tag.send(:initialize, tag_name, markup, tokens, options) new_tag end def initialize(tag_name, markup, tokens, options) @tag_name = tag_name @markup = markup @options = options || {} @line = @options[:line] || 1 parse(tokens) end def parse(tokens) end def name self.class.name.downcase end def render(context) '' end def blank? @blank || true end def parse_with_selected_parser(markup) case @options[:error_mode] || Template.error_mode when :strict then strict_parse_with_error_context(markup) when :lax then lax_parse(markup) when :warn begin return strict_parse_with_error_context(markup) rescue SyntaxError => e @warnings ||= [] @warnings << e return lax_parse(markup) end end end private def strict_parse_with_error_context(markup) strict_parse(markup) rescue SyntaxError => e e.message << " in \"#{markup.strip}\"" raise e end end # Tag end # Liquid
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
locomotivecms-liquid-2.6.0 | lib/liquid/tag.rb |