Class: Asciidoctor::DocTest::NoFallbackTemplateConverter
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Asciidoctor::DocTest::NoFallbackTemplateConverter
- Defined in:
- lib/asciidoctor/doctest/asciidoc_renderer.rb
Overview
TemplateConverter that doesn’t fallback to a built-in converter when no template for a node is found.
Constant Summary collapse
- NOT_FOUND_MARKER =
Placeholder to be written in a rendered output in place of the node’s content that cannot be rendered due to missing template.
'--TEMPLATE NOT FOUND--'
Instance Method Summary collapse
-
#convert(node, template_name = nil, opts = {}) ⇒ Object
(also: #convert_with_options)
Delegates to the template converter and returns results, or prints warning and returns NOT_FOUND_MARKER if there is no template to handle the specified
template_name. -
#initialize(backend, opts = {}) ⇒ NoFallbackTemplateConverter
constructor
A new instance of NoFallbackTemplateConverter.
Constructor Details
#initialize(backend, opts = {}) ⇒ NoFallbackTemplateConverter
Returns a new instance of NoFallbackTemplateConverter.
85 86 87 |
# File 'lib/asciidoctor/doctest/asciidoc_renderer.rb', line 85 def initialize(backend, opts = {}) super Asciidoctor::Converter::TemplateConverter.new(backend, opts[:template_dirs], opts) end |
Instance Method Details
#convert(node, template_name = nil, opts = {}) ⇒ Object Also known as: convert_with_options
Delegates to the template converter and returns results, or prints warning and returns NOT_FOUND_MARKER if there is no template to handle the specified template_name.
93 94 95 96 97 98 99 100 101 102 |
# File 'lib/asciidoctor/doctest/asciidoc_renderer.rb', line 93 def convert(node, template_name = nil, opts = {}) template_name ||= node.node_name if handles? template_name super else warn "Could not find a custom template to handle template_name: #{template_name}" NOT_FOUND_MARKER end end |