Class: Asciidoctor::Foodogsquared::Extensions::RepologyInlineMacro

Inherits:
Extensions::InlineMacroProcessor
  • Object
show all
Defined in:
lib/asciidoctor/foodogsquared/extensions/repology-inline-macro.rb

Instance Method Summary collapse

Instance Method Details

#process(parent, target, attrs) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/asciidoctor/foodogsquared/extensions/repology-inline-macro.rb', line 10

def process(parent, target, attrs)
  doc = parent.document
  text = attrs['caption'] || target
  url = %(https://repology.org/project/#{target})

  doc.register :links, url

  create_anchor parent, text, type: :link, target: url
end