On Thu, 2018-04-19 at 17:11 +0200, Takashi Iwai wrote:
This patch adds the support for asciidoctor to be used for
generating
documents instead of asciidoc. It's enabled via --enable-asciidoctor
configure option while asciidoc is used still as default.
In addition to the configure option, a few other changes were needed:
* some asciidoc.conf python stuff has to be replaced with asciidoctor
ruby extension; copied mostly from git
* asciidoctor requires slightly different options
* the man pages are generated directly via asciidoctor without xmlto
processing; less package dependency
Signed-off-by: Takashi Iwai <tiwai(a)suse.de>
---
Documentation/asciidoctor-extensions.rb.in | 28
++++++++++++++++++++++++++++
Documentation/daxctl/Makefile.am | 28
++++++++++++++++++++++++++--
Documentation/ndctl/Makefile.am | 28
++++++++++++++++++++++++++--
configure.ac | 17 +++++++++++++++--
4 files changed, 95 insertions(+), 6 deletions(-)
create mode 100644 Documentation/asciidoctor-extensions.rb.in
diff --git a/Documentation/asciidoctor-extensions.rb.in
b/Documentation/asciidoctor-extensions.rb.in
new file mode 100644
index 000000000000..ebdd665f1fb9
--- /dev/null
+++ b/Documentation/asciidoctor-extensions.rb.in
@@ -0,0 +1,28 @@
+require 'asciidoctor'
+require 'asciidoctor/extensions'
+
+module @Utility@
+ module Documentation
+ class Link@Utility@Processor <
Asciidoctor::Extensions::InlineMacroProcessor
+ use_dsl
+
+ named :chrome
+
+ def process(parent, target, attrs)
+ if parent.document.basebackend? 'html'
+ prefix = parent.document.attr('@utility@-relative-html-
prefix')
+ %(<a
href="#{prefix}#{target}.html">#{target}(#{attrs[1]})</a>\n)
+ 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 @Utility@::Documentation::Link@Utility@Processor, :link@u
tility@
+end
Hi Takashi,
It looks like this extension should be doing the right thing for the
'linkndctl' macros, but for some reason it doesn't seem to be working for
me. In the generated man pages:
SEE ALSO
linkndctl:ndctl-zero-labels[1], linkndctl:ndctl-init-labels[1]... etc.
Thanks,
-Vishal