mirror of
https://github.com/foo-dogsquared/asciidoctor-foodogsquared-extensions.git
synced 2025-01-30 22:57:56 +00:00
Add voidlinux
and none
for possible services in man inline macro
This commit is contained in:
parent
02bebfef70
commit
ff59ce0fca
@ -35,6 +35,11 @@ This is also the default service when no value is given.
|
||||
|
||||
- `opensuse` uses https://manpages.opensuse.org.
|
||||
|
||||
- `voidlinux` use https://man.voidlinux.org.
|
||||
|
||||
- `none` uses none at all. :)
|
||||
This is useful if the reference is not found anywhere.
|
||||
|
||||
Any invalid value raises an error.
|
||||
--
|
||||
|
||||
|
@ -13,22 +13,28 @@ class ManInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
|
||||
suffix = (volnum = attrs['volnum']) ? %((#{volnum})) : ''
|
||||
|
||||
if doc.basebackend? 'html'
|
||||
case attrs['service']
|
||||
when 'debian'
|
||||
domain = 'https://manpages.debian.org'
|
||||
when 'arch'
|
||||
domain = 'https://man.archlinux.org/man'
|
||||
when 'opensuse'
|
||||
domain = 'https://manpages.opensuse.org'
|
||||
when 'voidlinux'
|
||||
domain = 'https://man.voidlinux.org'
|
||||
else
|
||||
raise "no available manpage service #{attrs['service']}"
|
||||
end
|
||||
domain = case attrs['service']
|
||||
when 'debian'
|
||||
'https://manpages.debian.org'
|
||||
when 'arch'
|
||||
'https://man.archlinux.org/man'
|
||||
when 'opensuse'
|
||||
'https://manpages.opensuse.org'
|
||||
when 'voidlinux'
|
||||
'https://man.voidlinux.org'
|
||||
when 'none'
|
||||
nil
|
||||
else
|
||||
raise "no available manpage service #{attrs['service']}"
|
||||
end
|
||||
|
||||
target = %(#{domain}/#{manname}.#{volnum})
|
||||
doc.register :links, target
|
||||
node = create_anchor parent, text, type: :link, target: target
|
||||
if !domain.nil?
|
||||
target = %(#{domain}/#{manname}.#{volnum})
|
||||
doc.register :links, target
|
||||
node = create_anchor parent, text, type: :link, target: target
|
||||
else
|
||||
node = create_inline parent, :quoted, manname
|
||||
end
|
||||
elsif doc.backend == 'manpage'
|
||||
node = create_inline parent, :quoted, manname, type: :strong
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user