mirror of
https://github.com/foo-dogsquared/website.git
synced 2025-01-31 01:57:54 +00:00
Improve man inline macro
This commit is contained in:
parent
1cd296f0c0
commit
5f371b97e2
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user