Class: Asciibook::Converter

Inherits:
Asciidoctor::Converter::Base
  • Object
show all
Defined in:
lib/asciibook/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.



7
8
9
10
11
12
# File 'lib/asciibook/converter.rb', line 7

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

Instance Method Details

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



14
15
16
# File 'lib/asciibook/converter.rb', line 14

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