class Asciidoctor::Converter::TemplateConverter

def initialize backend, template_dirs, opts = {}

def initialize backend, template_dirs, opts = {}
  Helpers.require_library 'tilt' unless defined? ::Tilt.new
  @backend = backend
  @templates = {}
  @template_dirs = template_dirs
  @eruby = opts[:eruby]
  @safe = opts[:safe]
  @active_engines = {}
  @engine = opts[:template_engine]
  @engine_options = {}.tap {|accum| DEFAULT_ENGINE_OPTIONS.each {|engine, engine_opts| accum[engine] = engine_opts.merge } }
  if opts[:htmlsyntax] == 'html' # if not set, assume xml since this converter is also used for DocBook (which doesn't specify htmlsyntax)
    @engine_options[:haml][:format] = :html5
    @engine_options[:slim][:format] = :html
  end
  @engine_options[:slim][:include_dirs] = template_dirs.reverse.map {|dir| ::File.expand_path dir }
  if (overrides = opts[:template_engine_options])
    overrides.each do |engine, override_opts|
      (@engine_options[engine] ||= {}).update override_opts
    end
  end
  case opts[:template_cache]
  when true
    logger.warn 'optional gem \'concurrent-ruby\' is not available. This gem is recommended when using the default template cache.' unless defined? ::Concurrent::Map
    @caches = self.class.caches
  when ::Hash
    @caches = opts[:template_cache]
  else
    @caches = {} # the empty Hash effectively disables caching
  end
  scan
end