brintos

brintos / linux-shallow public Read only

0
0
Text · 816 B · d148fe9 Raw
30 lines · plain
1require 'asciidoctor'2require 'asciidoctor/extensions'3 4module Perf5  module Documentation6    class LinkPerfProcessor < Asciidoctor::Extensions::InlineMacroProcessor7      use_dsl8 9      named :chrome10 11      def process(parent, target, attrs)12        if parent.document.basebackend? 'html'13          %(<a href="#{target}.html">#{target}(#{attrs[1]})</a>\n)14        elsif parent.document.basebackend? 'manpage'15          "#{target}(#{attrs[1]})"16        elsif parent.document.basebackend? 'docbook'17          "<citerefentry>\n" \18            "<refentrytitle>#{target}</refentrytitle>" \19            "<manvolnum>#{attrs[1]}</manvolnum>\n" \20          "</citerefentry>\n"21        end22      end23    end24  end25end26 27Asciidoctor::Extensions.register do28  inline_macro Perf::Documentation::LinkPerfProcessor, :linkperf29end30