Commits

Anonymous committed f42ed02

modified index text

Comments (0)

Files changed (1)

sphinxcontrib/golangdomain.py

 
             entries = content.setdefault(pkgname[0].lower(), [])
 
-            package = pkgname.split('.')[0]
+            package = pkgname.split('/')[0]
             if package != pkgname:
                 # it's a subpackage
                 if prev_pkgname == package:
     name = 'go'
     label = 'Golang'
     object_types = {
-        'function': ObjType(l_('function'), 'func'),
-        'package':  ObjType(l_('package'),  'pkg'),
-        'type':     ObjType(l_('type'),     'type'),
-        'var':      ObjType(l_('variable'), 'data'),
-        'const':    ObjType(l_('const'),    'data'),
+        'function': ObjType(l_('function'), 'func', 'obj'),
+        'package':  ObjType(l_('package'),  'pkg', 'obj'),
+        'type':     ObjType(l_('type'),     'type', 'obj'),
+        'var':      ObjType(l_('variable'), 'data', 'obj'),
+        'const':    ObjType(l_('const'),    'data', 'obj'),
     }
 
     directives = {
         'pkg':    GolangXRefRole(),
         'type':   GolangXRefRole(),
         'data':   GolangXRefRole(),
+        'obj':    GolangXRefRole(),
     }
     initial_data = {
         'objects': {},    # fullname -> docname, objtype
 
     def resolve_xref(self, env, fromdocname, builder,
                      typ, target, node, contnode):
-        if typ == 'pkg' and target in self.data['packages']:
+        if (typ == 'pkg' or 
+            typ == 'obj' and target in self.data['packages']):
             docname, synopsis, platform, deprecated = \
-                self.data['packages'].get(target, ('','','', ''))
+                self.data['packages'].get(target, ('','','',''))
             if not docname:
                 return None
             else:
 
 
     def get_objects(self):
+        for pkgname, info in self.data['packages'].iteritems():
+            yield (pkgname, pkgname, 'package', info[0], 'package-' + pkgname, 0)
         for refname, (docname, type) in self.data['objects'].iteritems():
             yield (refname, refname, type, docname, refname, 1)