13 from docutils
import nodes, utils
14 from docutils.parsers.rst.roles
import set_classes
15 from string
import Template
19 ref = app.config.man_url_regex
21 ref =
"https://man7.org/linux/man-pages/man%s/%s.%s.html" %(manpage_num, name, manpage_num)
24 ref = s.substitute(num=manpage_num, topic=name)
26 node = nodes.reference(rawtext,
"%s(%s)" % (name, manpage_num), refuri=ref, **options)
30 def man_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
31 app = inliner.document.settings.env.app
32 p = re.compile(
"([a-zA-Z0-9_\.-_]+)\((\d)\)")
35 manpage_num = m.group(2)
42 app.add_role(
'man', man_role)
43 app.add_config_value(
'man_url_regex',
None,
'env')
def make_link_node(rawtext, app, name, manpage_num, options)
def man_role(name, rawtext, text, lineno, inliner, options={}, content=[])