Class: Asciidoctor::Htmlbook::Converter

Inherits:
Converter::Base
  • Object
show all
Defined in:
lib/asciidoctor/htmlbook/converter.rb

Constant Summary collapse

DEFAULT_TEMPLATE_PATH =
File.expand_path('../../../../templates', __FILE__)

Instance Method Summary collapse

Constructor Details

#initialize(backend, options = {}) ⇒ Converter

Returns a new instance of Converter.



8
9
10
11
12
13
# File 'lib/asciidoctor/htmlbook/converter.rb', line 8

def initialize(backend, options = {})
  super
  init_backend_traits outfilesuffix: '.html'
  @template_dirs = (options[:template_dirs] || []).unshift(DEFAULT_TEMPLATE_PATH)
  @templates = {}
end

Instance Method Details

#convert(node, transform = node.node_name, options = {}) ⇒ Object



15
16
17
# File 'lib/asciidoctor/htmlbook/converter.rb', line 15

def convert(node, transform = node.node_name, options = {})
  get_template(transform).render 'node' => node_to_hash(node)
end