diff options
author | Robert Göhler <github@ghlr.de> | 2019-12-29 10:43:13 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-12-29 10:43:13 +0100 |
commit | addb616f6cf862f243e058b9d05da6f7d9422a7a (patch) | |
tree | a21350c2d4b43c15c0009ea57b2a665a356607e3 /docs/conf.py | |
parent | 21aec14168f723a52f3a7a2e90c9a1075d94de0c (diff) | |
download | vyos-documentation-addb616f6cf862f243e058b9d05da6f7d9422a7a.tar.gz vyos-documentation-addb616f6cf862f243e058b9d05da6f7d9422a7a.zip |
sphinx: integrate standalone vytask command in conf.py
References to VyOS Phabricator can now be build by using the statemenmt: :vytask:`T1234`
Diffstat (limited to 'docs/conf.py')
-rw-r--r-- | docs/conf.py | 18 |
1 files changed, 18 insertions, 0 deletions
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') |