Commits

georg.brandl  committed d2788f8

Strip parentheses for C function pointer type names.

  • Participants
  • Parent commits 054affc

Comments (0)

Files changed (1)

File sphinx/directives.py

         (\( [^()]+ \)) \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+)')
     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