From 355191ab0b3affa49eca4c12792a5e8d1e36df33 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 7 Oct 2017 04:11:29 +0200 Subject: [PATCH] implement simple "issue" role for manpage generation, fixes #3075 (cherry picked from commit bf3f8e567283f43f297670554d158588df38bf78) --- setup.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/setup.py b/setup.py index 899b10ee5..42b272613 100644 --- a/setup.py +++ b/setup.py @@ -653,6 +653,13 @@ class build_man(Command): def gen_man_page(self, name, rst): from docutils.writers import manpage from docutils.core import publish_string + from docutils.nodes import inline + from docutils.parsers.rst import roles + + def issue(name, rawtext, text, lineno, inliner, options={}, content=[]): + return [inline(rawtext, '#' + text)], [] + + roles.register_local_role('issue', issue) # We give the source_path so that docutils can find relative includes # as-if the document where located in the docs/ directory. man_page = publish_string(source=rst, source_path='docs/virtmanpage.rst', writer=manpage.Writer())