Class: Asciidoctor::BeautifyUri::UriBlockMacro
- Inherits:
-
Extensions::BlockMacroProcessor
- Object
- Extensions::BlockMacroProcessor
- Asciidoctor::BeautifyUri::UriBlockMacro
- Defined in:
- lib/asciidoctor/beautify_uri/extensions.rb
Overview
uri::provider:path — see DESIGN-asciidoctor-beautify-uri.adoc, "Macro Syntax".
Instance Method Summary collapse
Instance Method Details
#process(parent, target, attrs) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/asciidoctor/beautify_uri/extensions.rb', line 15 def process(parent, target, attrs) doc = parent.document provider_key, path = target.split(':', 2) provider = ProviderRegistry.find(provider_key) unless provider Logging.debug(%(unknown provider "#{provider_key}" for target "#{target}")) return finish(parent, attrs, placeholder_node(parent, doc, target), nil) end data = resolve(provider, path, doc, target) unless data return finish(parent, attrs, placeholder_node(parent, doc, target), nil) end Logging.debug(%(#{provider.key} resolved "#{target}" -> #{[data[:title], data[:subtitle]].compact.join(' - ')})) thumbnail = attrs['thumbnail'] != 'false' reftext_body = [data[:title], data[:subtitle]].compact.reject(&:empty?).join(' - ') full_reftext = %(#{provider.display_name}: #{reftext_body}) node = render_card(parent, doc, provider, data, thumbnail) finish(parent, attrs, node, full_reftext) end |