mirror of
https://github.com/foo-dogsquared/website.git
synced 2025-01-31 07:58:02 +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
|
named :man
|
||||||
name_positional_attributes 'volnum'
|
name_positional_attributes 'volnum'
|
||||||
|
default_attributes 'domain' => 'manpages.debian.org'
|
||||||
|
|
||||||
def process parent, target, attrs
|
def process parent, target, attrs
|
||||||
doc = parent.document
|
doc = parent.document
|
||||||
text = manname = target
|
text = manname = target
|
||||||
suffix = (volnum = attrs['volnum']) ? %((#{volnum})) : ''
|
suffix = (volnum = attrs['volnum']) ? %((#{volnum})) : ''
|
||||||
|
|
||||||
if doc.basebackend? 'html'
|
if doc.basebackend? 'html'
|
||||||
target = %(#{manname}#{doc.outfilesuffix})
|
target = %(https://#{attrs['domain']}/#{manname}.#{volnum})
|
||||||
doc.register :links, target
|
doc.register :links, target
|
||||||
node = create_anchor parent, text, type: :link, target: target
|
node = create_anchor parent, text, type: :link, target: target
|
||||||
elsif doc.backend == 'manpage'
|
elsif doc.backend == 'manpage'
|
||||||
|
Loading…
Reference in New Issue
Block a user