Quellcode durchsuchen

implement simple "issue" role for manpage generation, fixes #3075

Thomas Waldmann vor 7 Jahren
Ursprung
Commit
bf3f8e5672
1 geänderte Dateien mit 7 neuen und 0 gelöschten Zeilen
  1. 7 0
      setup.py

+ 7 - 0
setup.py

@@ -657,6 +657,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())