Commit eff171c8 authored by Maciej Delmanowski's avatar Maciej Delmanowski

[docs] Add autolink support for manual pages

This patch implements automatic linking to the manual pages hosted on
https://manpages.debian.org/ using the '👨' reference syntax.
parent 00990a69
# -*- coding: utf-8 -*-
from .func import * # pylint: disable=wildcard-import
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 DebOps project https://debops.org/
from docutils import nodes
def setup(app):
app.add_role('man', autolink('https://manpages.debian.org/%s'))
def autolink(pattern):
def role(name, rawtext, text, lineno, inliner, options={}, content=[]):
url = pattern % (text,)
node = nodes.reference(rawtext, text, refuri=url, **options)
return [node], []
return role
......@@ -74,7 +74,8 @@ html_context = {
# ones.
extensions = [
'sphinx.ext.ifconfig',
'sphinx.ext.graphviz'
'sphinx.ext.graphviz',
'autolink'
]
# Add any paths that contain templates here, relative to this directory.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment