mirror of
https://github.com/vyos/vyos-documentation.git
synced 2025-10-26 08:41:46 +01:00
sphinx: integrate standalone vytask command in conf.py
References to VyOS Phabricator can now be build by using the statemenmt: :vytask:`T1234`
This commit is contained in:
parent
21aec14168
commit
addb616f6c
18
docs/conf.py
18
docs/conf.py
@ -16,6 +16,8 @@
|
||||
# import sys
|
||||
# sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
from docutils import nodes, utils
|
||||
from docutils.parsers.rst.roles import set_classes
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
|
||||
@ -169,6 +171,22 @@ texinfo_documents = [
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
|
||||
def vytask_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
|
||||
app = inliner.document.settings.env.app
|
||||
base = app.config.vyos_phabricator_url
|
||||
ref = base + str(text)
|
||||
set_classes(options)
|
||||
node = nodes.reference(
|
||||
rawtext, utils.unescape(str(text)), refuri=ref, **options)
|
||||
return [node], []
|
||||
|
||||
|
||||
def setup(app):
|
||||
app.add_config_value(
|
||||
'vyos_phabricator_url',
|
||||
'https://phabricator.vyos.net/', ''
|
||||
)
|
||||
app.add_role('vytask', vytask_role)
|
||||
app.add_object_type('opcmd', 'opcmd')
|
||||
app.add_object_type('cfgcmd', 'cfgcmd')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user