diff options
author | Georg Brandl <georg@python.org> | 2010-07-18 10:11:03 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-07-18 10:11:03 (GMT) |
commit | 02053ee3b9170966707a59c78778319a2fc1b091 (patch) | |
tree | ce35286bd00ab46edcbd07a88650ec4c3dfdbe01 /Doc/tools/sphinxext | |
parent | 1b3c2620271afef0ae08ef93b44150730ffd9e75 (diff) | |
download | cpython-02053ee3b9170966707a59c78778319a2fc1b091.zip cpython-02053ee3b9170966707a59c78778319a2fc1b091.tar.gz cpython-02053ee3b9170966707a59c78778319a2fc1b091.tar.bz2 |
#9279: remove the pdb.doc file, put its contents in pdb.__doc__. Also sync this and the pdb docs, introduce a new directive for pdb commands and a role to link to them.
Diffstat (limited to 'Doc/tools/sphinxext')
-rw-r--r-- | Doc/tools/sphinxext/pyspecific.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Doc/tools/sphinxext/pyspecific.py b/Doc/tools/sphinxext/pyspecific.py index a90b238..b7a6012 100644 --- a/Doc/tools/sphinxext/pyspecific.py +++ b/Doc/tools/sphinxext/pyspecific.py @@ -165,6 +165,28 @@ def parse_opcode_signature(env, sig, signode): return opname.strip() +pdbcmd_sig_re = re.compile(r'([a-z()!]+)\s*(.*)') + +# later... +#pdbargs_tokens_re = re.compile(r'''[a-zA-Z]+ | # identifiers +# [.,:]+ | # punctuation +# [\[\]()] | # parens +# \s+ # whitespace +# ''', re.X) + +def parse_pdb_command(env, sig, signode): + """Transform a pdb command signature into RST nodes.""" + m = pdbcmd_sig_re.match(sig) + if m is None: + raise ValueError + name, args = m.groups() + fullname = name.replace('(', '').replace(')', '') + signode += addnodes.desc_name(name, name) + if args: + signode += addnodes.desc_addname(' '+args, ' '+args) + return fullname + + def setup(app): app.add_role('issue', issue_role) app.add_directive('impl-detail', ImplementationDetail) @@ -172,4 +194,6 @@ def setup(app): app.add_builder(suspicious.CheckSuspiciousMarkupBuilder) app.add_description_unit('opcode', 'opcode', '%s (opcode)', parse_opcode_signature) + app.add_description_unit('pdbcommand', 'pdbcmd', '%s (pdb command)', + parse_pdb_command) app.add_description_unit('2to3fixer', '2to3fixer', '%s (2to3 fixer)') |