-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf Documentation: Support for asciidoctor
The asciidoc package seems behind the recent big wave of python3 conversion, and we were advised to switch to asciidoctor instead. It's almost compatible but some extensions used for perf documentation don't work with it. Here is the patch to cover them, and add the proper support for asciidoctor. Pass USE_ASCIIDOCTOR=yes to make for using asciidoctor instead of asciidoc. The man source and manual attributes are passed via command options. The support for these attributes have been fixed in the latest asciidoctor code. Since asciidoctor can covert to a man page and an HTML directly, we can omit the dependency on xmlto when USE_ASCIIDOCTOR is set. Signed-off-by: Takashi Iwai <tiwai@suse.de> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20180424150456.17353-1-tiwai@suse.de Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
- Loading branch information
Takashi Iwai
authored and
Arnaldo Carvalho de Melo
committed
Apr 26, 2018
1 parent
83cf774
commit ffef80e
Showing
2 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'asciidoctor' | ||
require 'asciidoctor/extensions' | ||
|
||
module Perf | ||
module Documentation | ||
class LinkPerfProcessor < Asciidoctor::Extensions::InlineMacroProcessor | ||
use_dsl | ||
|
||
named :chrome | ||
|
||
def process(parent, target, attrs) | ||
if parent.document.basebackend? 'html' | ||
%(<a href="#{target}.html">#{target}(#{attrs[1]})</a>\n) | ||
elsif parent.document.basebackend? 'manpage' | ||
"#{target}(#{attrs[1]})" | ||
elsif parent.document.basebackend? 'docbook' | ||
"<citerefentry>\n" \ | ||
"<refentrytitle>#{target}</refentrytitle>" \ | ||
"<manvolnum>#{attrs[1]}</manvolnum>\n" \ | ||
"</citerefentry>\n" | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Asciidoctor::Extensions.register do | ||
inline_macro Perf::Documentation::LinkPerfProcessor, :linkperf | ||
end |