|
21 | 21 | from sphinx.locale import _ as sphinx_gettext |
22 | 22 | from sphinx.util.docutils import SphinxDirective |
23 | 23 |
|
24 | | - |
25 | | -ISSUE_URI = 'https://bugs.python.org/issue?@action=redirect&bpo=%s' |
26 | | -GH_ISSUE_URI = 'https://github.com/python/cpython/issues/%s' |
27 | 24 | # Used in conf.py and updated here by python/release-tools/run_release.py |
28 | 25 | SOURCE_URI = 'https://github.com/python/cpython/tree/3.13/%s' |
29 | 26 |
|
|
34 | 31 | Body.enum.converters['lowerroman'] = \ |
35 | 32 | Body.enum.converters['upperroman'] = lambda x: None |
36 | 33 |
|
37 | | -# Support for marking up and linking to bugs.python.org issues |
38 | | - |
39 | | -def issue_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): |
40 | | - issue = unescape(text) |
41 | | - # sanity check: there are no bpo issues within these two values |
42 | | - if 47261 < int(issue) < 400000: |
43 | | - msg = inliner.reporter.error(f'The BPO ID {text!r} seems too high -- ' |
44 | | - 'use :gh:`...` for GitHub IDs', line=lineno) |
45 | | - prb = inliner.problematic(rawtext, rawtext, msg) |
46 | | - return [prb], [msg] |
47 | | - text = 'bpo-' + issue |
48 | | - refnode = nodes.reference(text, text, refuri=ISSUE_URI % issue) |
49 | | - return [refnode], [] |
50 | | - |
51 | | - |
52 | | -# Support for marking up and linking to GitHub issues |
53 | | - |
54 | | -def gh_issue_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): |
55 | | - issue = unescape(text) |
56 | | - # sanity check: all GitHub issues have ID >= 32426 |
57 | | - # even though some of them are also valid BPO IDs |
58 | | - if int(issue) < 32426: |
59 | | - msg = inliner.reporter.error(f'The GitHub ID {text!r} seems too low -- ' |
60 | | - 'use :issue:`...` for BPO IDs', line=lineno) |
61 | | - prb = inliner.problematic(rawtext, rawtext, msg) |
62 | | - return [prb], [msg] |
63 | | - text = 'gh-' + issue |
64 | | - refnode = nodes.reference(text, text, refuri=GH_ISSUE_URI % issue) |
65 | | - return [refnode], [] |
66 | | - |
67 | 34 |
|
68 | 35 | class PyAwaitableMixin(object): |
69 | 36 | def handle_signature(self, sig, signode): |
@@ -160,8 +127,6 @@ def patch_pairindextypes(app, _env) -> None: |
160 | 127 |
|
161 | 128 |
|
162 | 129 | def setup(app): |
163 | | - app.add_role('issue', issue_role) |
164 | | - app.add_role('gh', gh_issue_role) |
165 | 130 | app.add_object_type('opcode', 'opcode', '%s (opcode)', parse_opcode_signature) |
166 | 131 | app.add_object_type('pdbcommand', 'pdbcmd', '%s (pdb command)', parse_pdb_command) |
167 | 132 | app.add_object_type('monitoring-event', 'monitoring-event', '%s (monitoring event)', parse_monitoring_event) |
|
0 commit comments