mirror of
https://github.com/foo-dogsquared/asciidoctor-foodogsquared-extensions.git
synced 2025-02-07 12:19:14 +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.
|
- `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.
|
Any invalid value raises an error.
|
||||||
--
|
--
|
||||||
|
|
||||||
|
@ -13,22 +13,28 @@ class ManInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
|
|||||||
suffix = (volnum = attrs['volnum']) ? %((#{volnum})) : ''
|
suffix = (volnum = attrs['volnum']) ? %((#{volnum})) : ''
|
||||||
|
|
||||||
if doc.basebackend? 'html'
|
if doc.basebackend? 'html'
|
||||||
case attrs['service']
|
domain = case attrs['service']
|
||||||
when 'debian'
|
when 'debian'
|
||||||
domain = 'https://manpages.debian.org'
|
'https://manpages.debian.org'
|
||||||
when 'arch'
|
when 'arch'
|
||||||
domain = 'https://man.archlinux.org/man'
|
'https://man.archlinux.org/man'
|
||||||
when 'opensuse'
|
when 'opensuse'
|
||||||
domain = 'https://manpages.opensuse.org'
|
'https://manpages.opensuse.org'
|
||||||
when 'voidlinux'
|
when 'voidlinux'
|
||||||
domain = 'https://man.voidlinux.org'
|
'https://man.voidlinux.org'
|
||||||
|
when 'none'
|
||||||
|
nil
|
||||||
else
|
else
|
||||||
raise "no available manpage service #{attrs['service']}"
|
raise "no available manpage service #{attrs['service']}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if !domain.nil?
|
||||||
target = %(#{domain}/#{manname}.#{volnum})
|
target = %(#{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
|
||||||
|
else
|
||||||
|
node = create_inline parent, :quoted, manname
|
||||||
|
end
|
||||||
elsif doc.backend == 'manpage'
|
elsif doc.backend == 'manpage'
|
||||||
node = create_inline parent, :quoted, manname, type: :strong
|
node = create_inline parent, :quoted, manname, type: :strong
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user