]> granicus.if.org Git - python/commitdiff
Add :issue: directive for easy linking to bugs.python.org.
authorGeorg Brandl <georg@python.org>
Wed, 9 Apr 2008 17:58:56 +0000 (17:58 +0000)
committerGeorg Brandl <georg@python.org>
Wed, 9 Apr 2008 17:58:56 +0000 (17:58 +0000)
Doc/conf.py
Doc/tools/sphinxext/pyspecific.py [new file with mode: 0644]

index f6c08c517862968fe94013e2db56d3a9c45d8b5d..6a452420fe3a18333c13a0668d4c69747fee99c2 100644 (file)
@@ -14,7 +14,7 @@ sys.path.append('tools/sphinxext')
 # ---------------------
 
 extensions = ['sphinx.ext.refcounting', 'sphinx.ext.coverage',
-              'sphinx.ext.doctest']
+              'sphinx.ext.doctest', 'pyspecific']
 templates_path = ['tools/sphinxext']
 
 # General substitutions.
diff --git a/Doc/tools/sphinxext/pyspecific.py b/Doc/tools/sphinxext/pyspecific.py
new file mode 100644 (file)
index 0000000..f7c0daa
--- /dev/null
@@ -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)