From 928cd80561957a529551e42cad8123840aa6afa0 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Sun, 29 Oct 2023 12:49:08 +0800 Subject: [PATCH] Update the default text for manpages link --- lib/asciidoctor/man-inline-macro/extension.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/asciidoctor/man-inline-macro/extension.rb b/lib/asciidoctor/man-inline-macro/extension.rb index dcecce9..3c1bd4d 100644 --- a/lib/asciidoctor/man-inline-macro/extension.rb +++ b/lib/asciidoctor/man-inline-macro/extension.rb @@ -9,8 +9,10 @@ class ManInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor def process(parent, target, attrs) doc = parent.document - text = manname = target - suffix = (volnum = attrs['volnum']) ? %((#{volnum})) : '' + manname = target + volnum = attrs['volnum'] + + text = %(#{manname}(#{volnum})) if doc.basebackend? 'html' domain = case attrs['service'] @@ -35,13 +37,14 @@ class ManInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor doc.register :links, target node = create_anchor parent, text, type: :link, target: target else - node = create_inline parent, :quoted, manname + node = create_inline parent, :quoted, text end elsif doc.backend == 'manpage' - node = create_inline parent, :quoted, manname, type: :strong + node = create_inline parent, :quoted, text, type: :strong else - node = create_inline parent, :quoted, manname + node = create_inline parent, :quoted, text end - create_inline parent, :quoted, %(#{node.convert}#{suffix}) + + node end end