2 require 'asciidoctor/extensions'
6 class LinkGitProcessor < Asciidoctor::Extensions::InlineMacroProcessor
11 def process(parent, target, attrs)
12 if parent.document.basebackend? 'html'
13 prefix = parent.document.attr('git-relative-html-prefix')
14 %(<a href="#{prefix}#{target}.html">#{target}(#{attrs[1]})</a>)
15 elsif parent.document.basebackend? 'docbook'
17 "<refentrytitle>#{target}</refentrytitle>" \
18 "<manvolnum>#{attrs[1]}</manvolnum>\n" \
26 Asciidoctor::Extensions.register do
27 inline_macro Git::Documentation::LinkGitProcessor, :linkgit