Class: Asciidoctor::Revealjs::Converter
- Inherits:
-
Converter::CompositeConverter
- Object
- Converter::CompositeConverter
- Asciidoctor::Revealjs::Converter
- Defined in:
- lib/asciidoctor-revealjs/converter.rb
Constant Summary collapse
- ProvidedTemplatesDir =
RUBY_ENGINE == 'opal' ? 'node_modules/asciidoctor-reveal.js/templates' : (::File. '../../../templates', __FILE__)
Instance Method Summary collapse
-
#initialize(backend, opts = {}) ⇒ Converter
constructor
A new instance of Converter.
Constructor Details
#initialize(backend, opts = {}) ⇒ Converter
Returns a new instance of Converter.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/asciidoctor-revealjs/converter.rb', line 13 def initialize backend, opts = {} # merge user templates with provided templates (user wins) template_dirs = [ProvidedTemplatesDir] if (user_template_dirs = opts[:template_dirs]) template_dirs += user_template_dirs.map {|d| ::File. d } end # Engine Opal means we need to use the Javascript based templates if RUBY_ENGINE == 'opal' template_engine = 'jade' else template_engine = 'slim' end # create the main converter template_converter = ::Asciidoctor::Converter::TemplateConverter.new backend, template_dirs, (opts.merge htmlsyntax: 'html', template_engine: template_engine) # create the delegate / fallback converter html5_converter = ::Asciidoctor::Converter::Html5Converter.new backend, opts # fuse the converters together super backend, template_converter, html5_converter basebackend 'html' htmlsyntax 'html' end |