tests: clean after SANITY tests
[alt-git.git] / Documentation / asciidoctor-extensions.rb
blobec83b4959eb4d8b278ca6e769cbbaca0cba7cb06
1 require 'asciidoctor'
2 require 'asciidoctor/extensions'
4 module Git
5   module Documentation
6     class LinkGitProcessor < Asciidoctor::Extensions::InlineMacroProcessor
7       use_dsl
9       named :chrome
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>\n)
15         elsif parent.document.basebackend? 'docbook'
16           "<citerefentry>\n" \
17             "<refentrytitle>#{target}</refentrytitle>" \
18             "<manvolnum>#{attrs[1]}</manvolnum>\n" \
19           "</citerefentry>\n"
20         end
21       end
22     end
23   end
24 end
26 Asciidoctor::Extensions.register do
27   inline_macro Git::Documentation::LinkGitProcessor, :linkgit
28 end