blob: f7c0daa1d9a83bcacf8244301ef3e7ccf4161095 [file] [log] [blame]
Martin v. Löwis5680d0c2008-04-10 03:06:53 +00001# -*- coding: utf-8 -*-
2"""
3 pyspecific.py
4 ~~~~~~~~~~~~~
5
6 Sphinx extension with Python doc-specific markup.
7
8 :copyright: 2008 by Georg Brandl.
9 :license: Python license.
10"""
11
12ISSUE_URI = 'http://bugs.python.org/issue%s'
13
14from docutils import nodes, utils
15
16def issue_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
17 issue = utils.unescape(text)
18 text = 'issue ' + issue
19 refnode = nodes.reference(text, text, refuri=ISSUE_URI % issue)
20 return [refnode], []
21
22
23def setup(app):
24 app.add_role('issue', issue_role)