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 | |
Georg Brandl | 7ed509a | 2014-01-21 19:20:31 +0100 | [diff] [blame] | 8 | :copyright: 2008-2014 by Georg Brandl. |
Martin v. Löwis | 5680d0c | 2008-04-10 03:06:53 +0000 | [diff] [blame] | 9 | :license: Python license. |
| 10 | """ |
| 11 | |
| 12 | ISSUE_URI = 'http://bugs.python.org/issue%s' |
Benjamin Peterson | 50ff858 | 2014-09-13 01:45:50 -0400 | [diff] [blame] | 13 | SOURCE_URI = 'https://hg.python.org/cpython/file/default/%s' |
Martin v. Löwis | 5680d0c | 2008-04-10 03:06:53 +0000 | [diff] [blame] | 14 | |
| 15 | from docutils import nodes, utils |
Georg Brandl | 239990d | 2013-10-12 20:50:21 +0200 | [diff] [blame] | 16 | |
Georg Brandl | 6881886 | 2010-11-06 07:19:35 +0000 | [diff] [blame] | 17 | from sphinx.util.nodes import split_explicit_title |
Georg Brandl | f7b2f36 | 2014-02-16 09:46:36 +0100 | [diff] [blame] | 18 | from sphinx.util.compat import Directive |
Georg Brandl | 239990d | 2013-10-12 20:50:21 +0200 | [diff] [blame] | 19 | from sphinx.writers.html import HTMLTranslator |
| 20 | from sphinx.writers.latex import LaTeXTranslator |
Martin v. Löwis | 5680d0c | 2008-04-10 03:06:53 +0000 | [diff] [blame] | 21 | |
Benjamin Peterson | 5c6d787 | 2009-02-06 02:40:07 +0000 | [diff] [blame] | 22 | # monkey-patch reST parser to disable alphabetic and roman enumerated lists |
| 23 | from docutils.parsers.rst.states import Body |
| 24 | Body.enum.converters['loweralpha'] = \ |
| 25 | Body.enum.converters['upperalpha'] = \ |
| 26 | Body.enum.converters['lowerroman'] = \ |
| 27 | Body.enum.converters['upperroman'] = lambda x: None |
| 28 | |
Georg Brandl | 83e51f4 | 2012-10-10 16:45:11 +0200 | [diff] [blame] | 29 | # monkey-patch HTML and LaTeX translators to keep doctest blocks in the |
| 30 | # doctest docs themselves |
| 31 | orig_visit_literal_block = HTMLTranslator.visit_literal_block |
| 32 | def new_visit_literal_block(self, node): |
| 33 | meta = self.builder.env.metadata[self.builder.current_docname] |
| 34 | old_trim_doctest_flags = self.highlighter.trim_doctest_flags |
| 35 | if 'keepdoctest' in meta: |
| 36 | self.highlighter.trim_doctest_flags = False |
| 37 | try: |
| 38 | orig_visit_literal_block(self, node) |
| 39 | finally: |
| 40 | self.highlighter.trim_doctest_flags = old_trim_doctest_flags |
| 41 | |
| 42 | HTMLTranslator.visit_literal_block = new_visit_literal_block |
| 43 | |
| 44 | orig_depart_literal_block = LaTeXTranslator.depart_literal_block |
| 45 | def new_depart_literal_block(self, node): |
| 46 | meta = self.builder.env.metadata[self.curfilestack[-1]] |
| 47 | old_trim_doctest_flags = self.highlighter.trim_doctest_flags |
| 48 | if 'keepdoctest' in meta: |
| 49 | self.highlighter.trim_doctest_flags = False |
| 50 | try: |
| 51 | orig_depart_literal_block(self, node) |
| 52 | finally: |
| 53 | self.highlighter.trim_doctest_flags = old_trim_doctest_flags |
| 54 | |
| 55 | LaTeXTranslator.depart_literal_block = new_depart_literal_block |
Benjamin Peterson | 5c6d787 | 2009-02-06 02:40:07 +0000 | [diff] [blame] | 56 | |
Georg Brandl | 495f7b5 | 2009-10-27 15:28:25 +0000 | [diff] [blame] | 57 | # Support for marking up and linking to bugs.python.org issues |
| 58 | |
Martin v. Löwis | 5680d0c | 2008-04-10 03:06:53 +0000 | [diff] [blame] | 59 | def issue_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): |
| 60 | issue = utils.unescape(text) |
| 61 | text = 'issue ' + issue |
| 62 | refnode = nodes.reference(text, text, refuri=ISSUE_URI % issue) |
| 63 | return [refnode], [] |
| 64 | |
| 65 | |
Georg Brandl | 6881886 | 2010-11-06 07:19:35 +0000 | [diff] [blame] | 66 | # Support for linking to Python source files easily |
| 67 | |
| 68 | def source_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): |
| 69 | has_t, title, target = split_explicit_title(text) |
| 70 | title = utils.unescape(title) |
| 71 | target = utils.unescape(target) |
| 72 | refnode = nodes.reference(title, title, refuri=SOURCE_URI % target) |
| 73 | return [refnode], [] |
| 74 | |
| 75 | |
Georg Brandl | 495f7b5 | 2009-10-27 15:28:25 +0000 | [diff] [blame] | 76 | # Support for marking up implementation details |
| 77 | |
Georg Brandl | 495f7b5 | 2009-10-27 15:28:25 +0000 | [diff] [blame] | 78 | class ImplementationDetail(Directive): |
| 79 | |
| 80 | has_content = True |
| 81 | required_arguments = 0 |
| 82 | optional_arguments = 1 |
| 83 | final_argument_whitespace = True |
| 84 | |
| 85 | def run(self): |
| 86 | pnode = nodes.compound(classes=['impl-detail']) |
| 87 | content = self.content |
| 88 | add_text = nodes.strong('CPython implementation detail:', |
| 89 | 'CPython implementation detail:') |
| 90 | if self.arguments: |
| 91 | n, m = self.state.inline_text(self.arguments[0], self.lineno) |
| 92 | pnode.append(nodes.paragraph('', '', *(n + m))) |
| 93 | self.state.nested_parse(content, self.content_offset, pnode) |
| 94 | if pnode.children and isinstance(pnode[0], nodes.paragraph): |
| 95 | pnode[0].insert(0, add_text) |
| 96 | pnode[0].insert(1, nodes.Text(' ')) |
| 97 | else: |
| 98 | pnode.insert(0, nodes.paragraph('', '', add_text)) |
| 99 | return [pnode] |
| 100 | |
| 101 | |
Georg Brandl | 8a1caa2 | 2010-07-29 16:01:11 +0000 | [diff] [blame] | 102 | # Support for documenting decorators |
| 103 | |
| 104 | from sphinx import addnodes |
| 105 | from sphinx.domains.python import PyModulelevel, PyClassmember |
| 106 | |
| 107 | class PyDecoratorMixin(object): |
| 108 | def handle_signature(self, sig, signode): |
| 109 | ret = super(PyDecoratorMixin, self).handle_signature(sig, signode) |
| 110 | signode.insert(0, addnodes.desc_addname('@', '@')) |
| 111 | return ret |
| 112 | |
| 113 | def needs_arglist(self): |
| 114 | return False |
| 115 | |
| 116 | class PyDecoratorFunction(PyDecoratorMixin, PyModulelevel): |
| 117 | def run(self): |
| 118 | # a decorator function is a function after all |
| 119 | self.name = 'py:function' |
| 120 | return PyModulelevel.run(self) |
| 121 | |
| 122 | class PyDecoratorMethod(PyDecoratorMixin, PyClassmember): |
| 123 | def run(self): |
| 124 | self.name = 'py:method' |
| 125 | return PyClassmember.run(self) |
| 126 | |
| 127 | |
Georg Brandl | 281d6ba | 2010-11-12 08:57:12 +0000 | [diff] [blame] | 128 | # Support for documenting version of removal in deprecations |
| 129 | |
Georg Brandl | 281d6ba | 2010-11-12 08:57:12 +0000 | [diff] [blame] | 130 | class DeprecatedRemoved(Directive): |
| 131 | has_content = True |
| 132 | required_arguments = 2 |
| 133 | optional_arguments = 1 |
| 134 | final_argument_whitespace = True |
| 135 | option_spec = {} |
| 136 | |
Georg Brandl | 7ed509a | 2014-01-21 19:20:31 +0100 | [diff] [blame] | 137 | _label = 'Deprecated since version %s, will be removed in version %s' |
| 138 | |
Georg Brandl | 281d6ba | 2010-11-12 08:57:12 +0000 | [diff] [blame] | 139 | def run(self): |
| 140 | node = addnodes.versionmodified() |
| 141 | node.document = self.state.document |
| 142 | node['type'] = 'deprecated-removed' |
| 143 | version = (self.arguments[0], self.arguments[1]) |
| 144 | node['version'] = version |
Georg Brandl | 7ed509a | 2014-01-21 19:20:31 +0100 | [diff] [blame] | 145 | text = self._label % version |
Georg Brandl | 281d6ba | 2010-11-12 08:57:12 +0000 | [diff] [blame] | 146 | if len(self.arguments) == 3: |
| 147 | inodes, messages = self.state.inline_text(self.arguments[2], |
| 148 | self.lineno+1) |
Georg Brandl | 7ed509a | 2014-01-21 19:20:31 +0100 | [diff] [blame] | 149 | para = nodes.paragraph(self.arguments[2], '', *inodes) |
| 150 | node.append(para) |
Georg Brandl | 281d6ba | 2010-11-12 08:57:12 +0000 | [diff] [blame] | 151 | else: |
Georg Brandl | 7ed509a | 2014-01-21 19:20:31 +0100 | [diff] [blame] | 152 | messages = [] |
| 153 | if self.content: |
| 154 | self.state.nested_parse(self.content, self.content_offset, node) |
Georg Brandl | 7ed509a | 2014-01-21 19:20:31 +0100 | [diff] [blame] | 155 | if isinstance(node[0], nodes.paragraph) and node[0].rawsource: |
| 156 | content = nodes.inline(node[0].rawsource, translatable=True) |
| 157 | content.source = node[0].source |
| 158 | content.line = node[0].line |
| 159 | content += node[0].children |
| 160 | node[0].replace_self(nodes.paragraph('', '', content)) |
Georg Brandl | f7b2f36 | 2014-02-16 09:46:36 +0100 | [diff] [blame] | 161 | node[0].insert(0, nodes.inline('', '%s: ' % text, |
| 162 | classes=['versionmodified'])) |
Ned Deily | b682fd3 | 2014-09-22 14:44:22 -0700 | [diff] [blame] | 163 | else: |
Georg Brandl | 7ed509a | 2014-01-21 19:20:31 +0100 | [diff] [blame] | 164 | para = nodes.paragraph('', '', |
| 165 | nodes.inline('', '%s.' % text, classes=['versionmodified'])) |
Berker Peksag | eb265ab | 2014-08-22 18:24:29 +0300 | [diff] [blame] | 166 | if len(node): |
| 167 | node.insert(0, para) |
| 168 | else: |
| 169 | node.append(para) |
Georg Brandl | 281d6ba | 2010-11-12 08:57:12 +0000 | [diff] [blame] | 170 | env = self.state.document.settings.env |
| 171 | env.note_versionchange('deprecated', version[0], node, self.lineno) |
Georg Brandl | 7ed509a | 2014-01-21 19:20:31 +0100 | [diff] [blame] | 172 | return [node] + messages |
Georg Brandl | 281d6ba | 2010-11-12 08:57:12 +0000 | [diff] [blame] | 173 | |
| 174 | |
Georg Brandl | 2cac28b | 2012-09-30 15:10:06 +0200 | [diff] [blame] | 175 | # Support for including Misc/NEWS |
| 176 | |
| 177 | import re |
| 178 | import codecs |
Georg Brandl | 2cac28b | 2012-09-30 15:10:06 +0200 | [diff] [blame] | 179 | |
Georg Brandl | 44d0c21 | 2012-10-01 19:08:50 +0200 | [diff] [blame] | 180 | issue_re = re.compile('([Ii])ssue #([0-9]+)') |
| 181 | whatsnew_re = re.compile(r"(?im)^what's new in (.*?)\??$") |
Georg Brandl | 2cac28b | 2012-09-30 15:10:06 +0200 | [diff] [blame] | 182 | |
| 183 | class MiscNews(Directive): |
| 184 | has_content = False |
| 185 | required_arguments = 1 |
| 186 | optional_arguments = 0 |
| 187 | final_argument_whitespace = False |
| 188 | option_spec = {} |
| 189 | |
| 190 | def run(self): |
| 191 | fname = self.arguments[0] |
| 192 | source = self.state_machine.input_lines.source( |
| 193 | self.lineno - self.state_machine.input_offset - 1) |
| 194 | source_dir = path.dirname(path.abspath(source)) |
Georg Brandl | 44d0c21 | 2012-10-01 19:08:50 +0200 | [diff] [blame] | 195 | fpath = path.join(source_dir, fname) |
| 196 | self.state.document.settings.record_dependencies.add(fpath) |
Georg Brandl | 2cac28b | 2012-09-30 15:10:06 +0200 | [diff] [blame] | 197 | try: |
Georg Brandl | 44d0c21 | 2012-10-01 19:08:50 +0200 | [diff] [blame] | 198 | fp = codecs.open(fpath, encoding='utf-8') |
Georg Brandl | 2cac28b | 2012-09-30 15:10:06 +0200 | [diff] [blame] | 199 | try: |
| 200 | content = fp.read() |
| 201 | finally: |
| 202 | fp.close() |
| 203 | except Exception: |
| 204 | text = 'The NEWS file is not available.' |
| 205 | node = nodes.strong(text, text) |
| 206 | return [node] |
Georg Brandl | 44d0c21 | 2012-10-01 19:08:50 +0200 | [diff] [blame] | 207 | content = issue_re.sub(r'`\1ssue #\2 <http://bugs.python.org/\2>`__', |
Georg Brandl | 2cac28b | 2012-09-30 15:10:06 +0200 | [diff] [blame] | 208 | content) |
Georg Brandl | 44d0c21 | 2012-10-01 19:08:50 +0200 | [diff] [blame] | 209 | content = whatsnew_re.sub(r'\1', content) |
Georg Brandl | 2cac28b | 2012-09-30 15:10:06 +0200 | [diff] [blame] | 210 | # remove first 3 lines as they are the main heading |
Georg Brandl | 6c47581 | 2012-10-01 19:27:05 +0200 | [diff] [blame] | 211 | lines = ['.. default-role:: obj', ''] + content.splitlines()[3:] |
Georg Brandl | 2cac28b | 2012-09-30 15:10:06 +0200 | [diff] [blame] | 212 | self.state_machine.insert_input(lines, fname) |
| 213 | return [] |
| 214 | |
| 215 | |
Georg Brandl | 6b38daa | 2008-06-01 21:05:17 +0000 | [diff] [blame] | 216 | # Support for building "topic help" for pydoc |
| 217 | |
| 218 | pydoc_topic_labels = [ |
| 219 | 'assert', 'assignment', 'atom-identifiers', 'atom-literals', |
| 220 | 'attribute-access', 'attribute-references', 'augassign', 'binary', |
| 221 | 'bitwise', 'bltin-code-objects', 'bltin-ellipsis-object', |
Benjamin Peterson | 0d31d58 | 2010-06-06 02:44:41 +0000 | [diff] [blame] | 222 | 'bltin-null-object', 'bltin-type-objects', 'booleans', |
Georg Brandl | 6b38daa | 2008-06-01 21:05:17 +0000 | [diff] [blame] | 223 | 'break', 'callable-types', 'calls', 'class', 'comparisons', 'compound', |
| 224 | 'context-managers', 'continue', 'conversions', 'customization', 'debugger', |
| 225 | 'del', 'dict', 'dynamic-features', 'else', 'exceptions', 'execmodel', |
| 226 | 'exprlists', 'floating', 'for', 'formatstrings', 'function', 'global', |
| 227 | 'id-classes', 'identifiers', 'if', 'imaginary', 'import', 'in', 'integers', |
Benjamin Peterson | f5a3d69 | 2010-08-31 14:31:01 +0000 | [diff] [blame] | 228 | 'lambda', 'lists', 'naming', 'nonlocal', 'numbers', 'numeric-types', |
| 229 | 'objects', 'operator-summary', 'pass', 'power', 'raise', 'return', |
| 230 | 'sequence-types', 'shifting', 'slicings', 'specialattrs', 'specialnames', |
| 231 | 'string-methods', 'strings', 'subscriptions', 'truth', 'try', 'types', |
| 232 | 'typesfunctions', 'typesmapping', 'typesmethods', 'typesmodules', |
| 233 | 'typesseq', 'typesseq-mutable', 'unary', 'while', 'with', 'yield' |
Georg Brandl | 6b38daa | 2008-06-01 21:05:17 +0000 | [diff] [blame] | 234 | ] |
| 235 | |
| 236 | from os import path |
| 237 | from time import asctime |
| 238 | from pprint import pformat |
| 239 | from docutils.io import StringOutput |
| 240 | from docutils.utils import new_document |
Benjamin Peterson | 6e43fb1 | 2008-12-21 00:16:13 +0000 | [diff] [blame] | 241 | |
Benjamin Peterson | 28d88b4 | 2009-01-09 03:03:23 +0000 | [diff] [blame] | 242 | from sphinx.builders import Builder |
| 243 | from sphinx.writers.text import TextWriter |
Georg Brandl | db6f108 | 2008-12-01 23:02:51 +0000 | [diff] [blame] | 244 | |
Georg Brandl | 6b38daa | 2008-06-01 21:05:17 +0000 | [diff] [blame] | 245 | |
| 246 | class PydocTopicsBuilder(Builder): |
| 247 | name = 'pydoc-topics' |
| 248 | |
| 249 | def init(self): |
| 250 | self.topics = {} |
| 251 | |
| 252 | def get_outdated_docs(self): |
| 253 | return 'all pydoc topics' |
| 254 | |
| 255 | def get_target_uri(self, docname, typ=None): |
| 256 | return '' # no URIs |
| 257 | |
| 258 | def write(self, *ignored): |
| 259 | writer = TextWriter(self) |
Benjamin Peterson | 5879d41 | 2009-03-30 14:51:56 +0000 | [diff] [blame] | 260 | for label in self.status_iterator(pydoc_topic_labels, |
| 261 | 'building topics... ', |
| 262 | length=len(pydoc_topic_labels)): |
Georg Brandl | 80ff2ad | 2010-07-31 08:27:46 +0000 | [diff] [blame] | 263 | if label not in self.env.domaindata['std']['labels']: |
Georg Brandl | 6b38daa | 2008-06-01 21:05:17 +0000 | [diff] [blame] | 264 | self.warn('label %r not in documentation' % label) |
| 265 | continue |
Georg Brandl | 80ff2ad | 2010-07-31 08:27:46 +0000 | [diff] [blame] | 266 | docname, labelid, sectname = self.env.domaindata['std']['labels'][label] |
Georg Brandl | 6b38daa | 2008-06-01 21:05:17 +0000 | [diff] [blame] | 267 | doctree = self.env.get_and_resolve_doctree(docname, self) |
| 268 | document = new_document('<section node>') |
| 269 | document.append(doctree.ids[labelid]) |
| 270 | destination = StringOutput(encoding='utf-8') |
| 271 | writer.write(document, destination) |
Ned Deily | b682fd3 | 2014-09-22 14:44:22 -0700 | [diff] [blame] | 272 | self.topics[label] = writer.output |
Georg Brandl | 6b38daa | 2008-06-01 21:05:17 +0000 | [diff] [blame] | 273 | |
| 274 | def finish(self): |
Ned Deily | b682fd3 | 2014-09-22 14:44:22 -0700 | [diff] [blame] | 275 | f = open(path.join(self.outdir, 'topics.py'), 'wb') |
Georg Brandl | 6b38daa | 2008-06-01 21:05:17 +0000 | [diff] [blame] | 276 | try: |
Ned Deily | b682fd3 | 2014-09-22 14:44:22 -0700 | [diff] [blame] | 277 | f.write('# -*- coding: utf-8 -*-\n'.encode('utf-8')) |
| 278 | f.write(('# Autogenerated by Sphinx on %s\n' % asctime()).encode('utf-8')) |
| 279 | f.write(('topics = ' + pformat(self.topics) + '\n').encode('utf-8')) |
Georg Brandl | 6b38daa | 2008-06-01 21:05:17 +0000 | [diff] [blame] | 280 | finally: |
| 281 | f.close() |
| 282 | |
Georg Brandl | 495f7b5 | 2009-10-27 15:28:25 +0000 | [diff] [blame] | 283 | |
Benjamin Peterson | 28d88b4 | 2009-01-09 03:03:23 +0000 | [diff] [blame] | 284 | # Support for checking for suspicious markup |
| 285 | |
| 286 | import suspicious |
Georg Brandl | 6b38daa | 2008-06-01 21:05:17 +0000 | [diff] [blame] | 287 | |
Georg Brandl | 495f7b5 | 2009-10-27 15:28:25 +0000 | [diff] [blame] | 288 | |
Georg Brandl | f0dd6a6 | 2008-07-23 15:19:11 +0000 | [diff] [blame] | 289 | # Support for documenting Opcodes |
| 290 | |
| 291 | import re |
Georg Brandl | f0dd6a6 | 2008-07-23 15:19:11 +0000 | [diff] [blame] | 292 | |
Georg Brandl | 4833e5b | 2010-07-03 10:41:33 +0000 | [diff] [blame] | 293 | opcode_sig_re = re.compile(r'(\w+(?:\+\d)?)(?:\s*\((.*)\))?') |
Georg Brandl | f0dd6a6 | 2008-07-23 15:19:11 +0000 | [diff] [blame] | 294 | |
| 295 | def parse_opcode_signature(env, sig, signode): |
| 296 | """Transform an opcode signature into RST nodes.""" |
| 297 | m = opcode_sig_re.match(sig) |
| 298 | if m is None: |
| 299 | raise ValueError |
| 300 | opname, arglist = m.groups() |
| 301 | signode += addnodes.desc_name(opname, opname) |
Georg Brandl | 4833e5b | 2010-07-03 10:41:33 +0000 | [diff] [blame] | 302 | if arglist is not None: |
| 303 | paramlist = addnodes.desc_parameterlist() |
| 304 | signode += paramlist |
| 305 | paramlist += addnodes.desc_parameter(arglist, arglist) |
Georg Brandl | f0dd6a6 | 2008-07-23 15:19:11 +0000 | [diff] [blame] | 306 | return opname.strip() |
| 307 | |
| 308 | |
Georg Brandl | 281d6ba | 2010-11-12 08:57:12 +0000 | [diff] [blame] | 309 | # Support for documenting pdb commands |
| 310 | |
Georg Brandl | 02053ee | 2010-07-18 10:11:03 +0000 | [diff] [blame] | 311 | pdbcmd_sig_re = re.compile(r'([a-z()!]+)\s*(.*)') |
| 312 | |
| 313 | # later... |
| 314 | #pdbargs_tokens_re = re.compile(r'''[a-zA-Z]+ | # identifiers |
| 315 | # [.,:]+ | # punctuation |
| 316 | # [\[\]()] | # parens |
| 317 | # \s+ # whitespace |
| 318 | # ''', re.X) |
| 319 | |
| 320 | def parse_pdb_command(env, sig, signode): |
| 321 | """Transform a pdb command signature into RST nodes.""" |
| 322 | m = pdbcmd_sig_re.match(sig) |
| 323 | if m is None: |
| 324 | raise ValueError |
| 325 | name, args = m.groups() |
| 326 | fullname = name.replace('(', '').replace(')', '') |
| 327 | signode += addnodes.desc_name(name, name) |
| 328 | if args: |
| 329 | signode += addnodes.desc_addname(' '+args, ' '+args) |
| 330 | return fullname |
| 331 | |
| 332 | |
Martin v. Löwis | 5680d0c | 2008-04-10 03:06:53 +0000 | [diff] [blame] | 333 | def setup(app): |
| 334 | app.add_role('issue', issue_role) |
Georg Brandl | 6881886 | 2010-11-06 07:19:35 +0000 | [diff] [blame] | 335 | app.add_role('source', source_role) |
Georg Brandl | 495f7b5 | 2009-10-27 15:28:25 +0000 | [diff] [blame] | 336 | app.add_directive('impl-detail', ImplementationDetail) |
Georg Brandl | 281d6ba | 2010-11-12 08:57:12 +0000 | [diff] [blame] | 337 | app.add_directive('deprecated-removed', DeprecatedRemoved) |
Georg Brandl | 6b38daa | 2008-06-01 21:05:17 +0000 | [diff] [blame] | 338 | app.add_builder(PydocTopicsBuilder) |
Benjamin Peterson | 28d88b4 | 2009-01-09 03:03:23 +0000 | [diff] [blame] | 339 | app.add_builder(suspicious.CheckSuspiciousMarkupBuilder) |
Georg Brandl | f0dd6a6 | 2008-07-23 15:19:11 +0000 | [diff] [blame] | 340 | app.add_description_unit('opcode', 'opcode', '%s (opcode)', |
| 341 | parse_opcode_signature) |
Georg Brandl | 02053ee | 2010-07-18 10:11:03 +0000 | [diff] [blame] | 342 | app.add_description_unit('pdbcommand', 'pdbcmd', '%s (pdb command)', |
| 343 | parse_pdb_command) |
Benjamin Peterson | f91df04 | 2009-02-13 02:50:59 +0000 | [diff] [blame] | 344 | app.add_description_unit('2to3fixer', '2to3fixer', '%s (2to3 fixer)') |
Georg Brandl | 8a1caa2 | 2010-07-29 16:01:11 +0000 | [diff] [blame] | 345 | app.add_directive_to_domain('py', 'decorator', PyDecoratorFunction) |
| 346 | app.add_directive_to_domain('py', 'decoratormethod', PyDecoratorMethod) |
Georg Brandl | 2cac28b | 2012-09-30 15:10:06 +0200 | [diff] [blame] | 347 | app.add_directive('miscnews', MiscNews) |
Georg Brandl | bae334c | 2014-09-30 22:17:41 +0200 | [diff] [blame] | 348 | return {'version': '1.0', 'parallel_read_safe': True} |