[Python-checkins] r62247 - in python/trunk/Doc: conf.py tools/sphinxext/pyspecific.py

georg.brandl python-checkins at python.org
Wed Apr 9 19:58:57 CEST 2008


Author: georg.brandl
Date: Wed Apr  9 19:58:56 2008
New Revision: 62247

Added:
   python/trunk/Doc/tools/sphinxext/pyspecific.py
Modified:
   python/trunk/Doc/conf.py
Log:
Add :issue: directive for easy linking to bugs.python.org.


Modified: python/trunk/Doc/conf.py
==============================================================================
--- python/trunk/Doc/conf.py	(original)
+++ python/trunk/Doc/conf.py	Wed Apr  9 19:58:56 2008
@@ -14,7 +14,7 @@
 # ---------------------
 
 extensions = ['sphinx.ext.refcounting', 'sphinx.ext.coverage',
-              'sphinx.ext.doctest']
+              'sphinx.ext.doctest', 'pyspecific']
 templates_path = ['tools/sphinxext']
 
 # General substitutions.

Added: python/trunk/Doc/tools/sphinxext/pyspecific.py
==============================================================================
--- (empty file)
+++ python/trunk/Doc/tools/sphinxext/pyspecific.py	Wed Apr  9 19:58:56 2008
@@ -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)


More information about the Python-checkins mailing list