diff options
author | Pauli Virtanen <pav@iki.fi> | 2009-03-17 19:27:56 +0000 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2009-03-17 19:27:56 +0000 |
commit | e9ef18bde5772aee31356064ae73ba59caeb249c (patch) | |
tree | fdc16b3a919e755dede1efe07dac62e42119470b /doc/sphinxext/autosummary.py | |
parent | 06f432130137c06f4c3d754c37eb756f45619ad6 (diff) | |
download | numpy-e9ef18bde5772aee31356064ae73ba59caeb249c.tar.gz |
sphinxext: autosummary: improve signature output & fix a bug in it
Diffstat (limited to 'doc/sphinxext/autosummary.py')
-rw-r--r-- | doc/sphinxext/autosummary.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/doc/sphinxext/autosummary.py b/doc/sphinxext/autosummary.py index 8cd08b778..481b9969e 100644 --- a/doc/sphinxext/autosummary.py +++ b/doc/sphinxext/autosummary.py @@ -190,8 +190,8 @@ def get_autosummary(names, state, no_signatures=False): table = nodes.table('') group = nodes.tgroup('', cols=2) table.append(group) - group.append(nodes.colspec('', colwidth=30)) - group.append(nodes.colspec('', colwidth=70)) + group.append(nodes.colspec('', colwidth=10)) + group.append(nodes.colspec('', colwidth=90)) body = nodes.tbody('') group.append(body) @@ -223,9 +223,9 @@ def get_autosummary(names, state, no_signatures=False): else: title = "" - col1 = ":obj:`%s <%s>`" % (name, real_name) + col1 = u":obj:`%s <%s>`" % (name, real_name) if doc['Signature']: - sig = re.sub('^[a-zA-Z_0-9.-]*', '', doc['Signature']) + sig = re.sub('^[^(\[]*', '', doc['Signature'].strip()) if '=' in sig: # abbreviate optional arguments sig = re.sub(r', ([a-zA-Z0-9_]+)=', r'[, \1=', sig, count=1) @@ -236,7 +236,8 @@ def get_autosummary(names, state, no_signatures=False): sig = re.sub(r'(\[.{16,16}[^,)]*?),.*?\]\)', r'\1, ...])', sig) else: sig = re.sub(r'(\(.{16,16}[^,)]*?),.*?\)', r'\1, ...)', sig) - col1 += " " + sig + # make signature contain non-breaking spaces + col1 += u"\\ \u00a0" + unicode(sig).replace(u" ", u"\u00a0") col2 = title append_row(col1, col2) |