summaryrefslogtreecommitdiff
path: root/sphinx/directives.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-03-25 20:59:01 +0000
committerGeorg Brandl <georg@python.org>2008-03-25 20:59:01 +0000
commit1e69f308ffdd1206ffd4fd630911d66ce9f03969 (patch)
treed9dfa4c537b3b7f22cdbd25dd304c7231bed97b5 /sphinx/directives.py
parent61849627d992decc4bb042ca5a587d258a00559c (diff)
downloadsphinx-git-1e69f308ffdd1206ffd4fd630911d66ce9f03969.tar.gz
Strip parentheses for C function pointer type names.
Diffstat (limited to 'sphinx/directives.py')
-rw-r--r--sphinx/directives.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/sphinx/directives.py b/sphinx/directives.py
index 50662e34c..cc8ae65a8 100644
--- a/sphinx/directives.py
+++ b/sphinx/directives.py
@@ -191,6 +191,7 @@ c_funcptr_sig_re = re.compile(
(\( [^()]+ \)) \s* # name in parentheses
\( (.*) \) $ # arguments
''', re.VERBOSE)
+c_funcptr_name_re = re.compile(r'^\(\s*\*\s*(.*?)\s*\)$')
# RE to split at word boundaries
wsplit_re = re.compile(r'(\W+)')
@@ -224,6 +225,10 @@ def parse_c_signature(signode, sig, desctype):
signode += addnodes.desc_type("", "")
parse_c_type(signode[-1], rettype)
signode += addnodes.desc_name(name, name)
+ # clean up parentheses from canonical name
+ m = c_funcptr_name_re.match(name)
+ if m:
+ name = m.group(1)
if not arglist:
if desctype == 'cfunction':
# for functions, add an empty parameter list