Documentation / asciidoctor-extensions.rbon commit commit-graph: always load commit-graph information (e2838d8)
   1require 'asciidoctor'
   2require 'asciidoctor/extensions'
   3
   4module Git
   5  module Documentation
   6    class LinkGitProcessor < Asciidoctor::Extensions::InlineMacroProcessor
   7      use_dsl
   8
   9      named :chrome
  10
  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
  24end
  25
  26Asciidoctor::Extensions.register do
  27  inline_macro Git::Documentation::LinkGitProcessor, :linkgit
  28end