summaryrefslogtreecommitdiffstats
path: root/Doc/tools
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-04-09 17:58:56 (GMT)
committerGeorg Brandl <georg@python.org>2008-04-09 17:58:56 (GMT)
commitc30519219627ddad24b3c60f419683183ae19c20 (patch)
tree0b4e3d98ae1940dc778ed25884e271b63eef655a /Doc/tools
parent99bb5f3fef86bae6512e2bf18f85a42f05cf0e09 (diff)
downloadcpython-c30519219627ddad24b3c60f419683183ae19c20.zip
cpython-c30519219627ddad24b3c60f419683183ae19c20.tar.gz
cpython-c30519219627ddad24b3c60f419683183ae19c20.tar.bz2
Add :issue: directive for easy linking to bugs.python.org.
Diffstat (limited to 'Doc/tools')
-rw-r--r--Doc/tools/sphinxext/pyspecific.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/Doc/tools/sphinxext/pyspecific.py b/Doc/tools/sphinxext/pyspecific.py
new file mode 100644
index 0000000..f7c0daa
--- /dev/null
+++ b/Doc/tools/sphinxext/pyspecific.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+"""
+ pyspecific.py
+ ~~~~~~~~~~~~~
+
+ Sphinx extension with Python doc-specific markup.
+
+ :copyright: 2008 by Georg Brandl.
+ :license: Python license.
+"""
+
+ISSUE_URI = 'http://bugs.python.org/issue%s'
+
+from docutils import nodes, utils
+
+def issue_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
+ issue = utils.unescape(text)
+ text = 'issue ' + issue
+ refnode = nodes.reference(text, text, refuri=ISSUE_URI % issue)
+ return [refnode], []
+
+
+def setup(app):
+ app.add_role('issue', issue_role)