From addb616f6cf862f243e058b9d05da6f7d9422a7a Mon Sep 17 00:00:00 2001 From: Robert Göhler Date: Sun, 29 Dec 2019 10:43:13 +0100 Subject: sphinx: integrate standalone vytask command in conf.py References to VyOS Phabricator can now be build by using the statemenmt: :vytask:`T1234` --- docs/conf.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'docs/conf.py') diff --git a/docs/conf.py b/docs/conf.py index 76293898..539f828d 100644 --- a/docs/conf.py +++ b/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') -- cgit v1.2.3