class Jekyll::LiquidRenderer

def self.format_error(error, path)

def self.format_error(error, path)
  "#{error.message} in #{path}"
end

def cache

It is emptied when `self.reset` is called.

via `LiquidRenderer::File#parse`
A persistent cache to store and retrieve parsed templates based on the filename
def cache
  @cache ||= {}
end

def file(filename)

def file(filename)
  filename = normalize_path(filename)
  LiquidRenderer::File.new(self, filename).tap do
    @stats[filename] ||= new_profile_hash
  end
end

def increment_bytes(filename, bytes)

def increment_bytes(filename, bytes)
  @stats[filename][:bytes] += bytes
end

def increment_count(filename)

def increment_count(filename)
  @stats[filename][:count] += 1
end

def increment_time(filename, time)

def increment_time(filename, time)
  @stats[filename][:time] += time
end

def initialize(site)

def initialize(site)
  @site = site
  Liquid::Template.error_mode = @site.config["liquid"]["error_mode"].to_sym
  reset
end

def new_profile_hash

def new_profile_hash
  Hash.new { |hash, key| hash[key] = 0 }
end

def normalize_path(filename)

def normalize_path(filename)
  @normalize_path ||= {}
  @normalize_path[filename] ||= begin
    theme_dir = @site.theme&.root
    case filename
    when %r!\A(#{Regexp.escape(@site.source)}/)(?<rest>.*)!io
      Regexp.last_match(:rest)
    when %r!(/gems/.*)*/gems/(?<dirname>[^/]+)(?<rest>.*)!,
         %r!(?<dirname>[^/]+/lib)(?<rest>.*)!
      "#{Regexp.last_match(:dirname)}#{Regexp.last_match(:rest)}"
    when theme_dir && %r!\A#{Regexp.escape(theme_dir)}/(?<rest>.*)!io
      PathManager.join(@site.theme.basename, Regexp.last_match(:rest))
    when %r!\A/(.*)!
      Regexp.last_match(1)
    else
      filename
    end
  end
end

def reset

def reset
  @stats = {}
  @cache = {}
end

def stats_table(num_of_rows = 50)

def stats_table(num_of_rows = 50)
  LiquidRenderer::Table.new(@stats).to_s(num_of_rows)
end