Martin v. Löwis | 5680d0c | 2008-04-10 03:06:53 +0000 | [diff] [blame] | 1 | # -*- 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 | |
| 12 | ISSUE_URI = 'http://bugs.python.org/issue%s' |
| 13 | |
| 14 | from docutils import nodes, utils |
| 15 | |
| 16 | def 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 | |
| 23 | def setup(app): |
| 24 | app.add_role('issue', issue_role) |