From 5f371b97e2b1da4995cd39cfc380467e8ef0adbb Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Sun, 5 Mar 2023 14:20:25 +0800 Subject: [PATCH] Improve man inline macro --- gems/lib/asciidoctor/man-inline-macro/extension.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gems/lib/asciidoctor/man-inline-macro/extension.rb b/gems/lib/asciidoctor/man-inline-macro/extension.rb index 807a017..b25a8be 100644 --- a/gems/lib/asciidoctor/man-inline-macro/extension.rb +++ b/gems/lib/asciidoctor/man-inline-macro/extension.rb @@ -3,13 +3,15 @@ class ManInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor named :man name_positional_attributes 'volnum' + default_attributes 'domain' => 'manpages.debian.org' def process parent, target, attrs doc = parent.document text = manname = target suffix = (volnum = attrs['volnum']) ? %((#{volnum})) : '' + if doc.basebackend? 'html' - target = %(#{manname}#{doc.outfilesuffix}) + target = %(https://#{attrs['domain']}/#{manname}.#{volnum}) doc.register :links, target node = create_anchor parent, text, type: :link, target: target elsif doc.backend == 'manpage'