Class: Asciidoctor::Foodogsquared::Extensions::CratesIOInlineMacro

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

Instance Method Summary collapse

Instance Method Details

#process(parent, target, attrs) ⇒ Object



48
49
50
51
52
53
54
55
56
# File 'lib/asciidoctor/foodogsquared/extensions/package-indices-macro.rb', line 48

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

  doc.register :links, url

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