perf tools: Use fallback for sample_addr_correlates_sym() cases
[linux/fpc-iii.git] / tools / perf / Documentation / asciidoctor-extensions.rb
blobd148fe95c0c447d3722e2a633a40006652bd7fea
1 require 'asciidoctor'
2 require 'asciidoctor/extensions'
4 module Perf
5   module Documentation
6     class LinkPerfProcessor < Asciidoctor::Extensions::InlineMacroProcessor
7       use_dsl
9       named :chrome
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         end
22       end
23     end
24   end
25 end
27 Asciidoctor::Extensions.register do
28   inline_macro Perf::Documentation::LinkPerfProcessor, :linkperf
29 end