Commits

Anonymous committed 988bd20

changing index strings

Comments (0)

Files changed (2)

sphinxcontrib/golangdomain.py

             signode += paramlist
 
         if retann:
-            signode += addnodes.desc_returns(retann, retann)
+            signode += addnodes.desc_addname(" ", u'\xa0')
+            signode += addnodes.desc_addname(retann, retann)
         return fullname
 
 
     def _get_index_text(self, name):
         if self.objtype == 'function':
-            return _('%s (Golang function)') % name
+            try:
+                methodname, funcname = name.split(' ')
+                # TODO(ymotongpoo): change format of method in index 
+                return _('%s() (Golang function)') % methodname
+            except ValueError:
+                funcname = name.split('.')[1]
+                # TODO(ymotongpoo): change format of function in index 
+                return _('%s() (Golang function)') % funcname
         elif self.objtype == 'variable':
             return _('%s (Golang variable)') % name
         elif self.objtype == 'const':
             signode['first'] = (not self.names)
             self.state.document.note_explicit_target(signode)
 
-            if self.objtype =='function':
+            if self.objtype == 'function':
                 finv = self.env.domaindata['go']['functions']
                 if name in finv:
                     self.env.warn(
 Go language
 -----------
 
-Package 'foo'
-~~~~~~~~~~~~~
+Package 'spam'
+~~~~~~~~~~~~~~
 
-.. go:package:: foo
+.. go:package:: spam
 
 .. go:const:: ConstTest
 
 .. go:var:: VariableTest
 
-.. go:type:: Spam
+.. go:type:: Foo
 
 .. go:function:: func FuncOne()
 
 Test Case - Access with package name in other packages (dummy_package)
 ----------------------------------------------------------------------
 
-.. go:type:: Spam
+.. go:type:: Foo
 
 .. go:function:: func FuncOne()
 
-:go:pkg:`foo`
+:go:pkg:`spam`
 
-:go:data:`foo.ConstTest`
+:go:data:`spam.ConstTest`
 
-:go:data:`foo.VariableTest`
+:go:data:`spam.VariableTest`
 
-:go:type:`foo.Spam`
+:go:type:`spam.Foo`
 
-:go:func:`foo.FuncOne`
+:go:func:`spam.FuncOne`
 
-:go:func:`(foo.Foo) MethodOne`
+:go:func:`(spam.Foo) MethodOne`
 
-:go:func:`(foo.Bar) MethodEight`
+:go:func:`(spam.Bar) MethodEight`
 
 following items should not be linked to *foo* package since current package is *dummy_package*.
 
-:go:type:`Spam`
+:go:type:`Foo`
 
 :go:func:`FuncOne`