Commits

Georg Brandl committed 9e35e7e

Fix #616: Allow keywords to be linked via intersphinx.

  • Participants
  • Parent commits 52124c3

Comments (0)

Files changed (3)

 Release 1.0.8 (Sep 22, 2011)
 ============================
 
+* #616: Allow keywords to be linked via intersphinx.
+
 * #613: Allow Unicode characters in production list token names.
 
 * #720: Add dummy visitors for graphviz nodes for text and man.

File sphinx/domains/std.py

     object_types = {
         'term': ObjType(l_('glossary term'), 'term', searchprio=-1),
         'token': ObjType(l_('grammar token'), 'token', searchprio=-1),
-        'label': ObjType(l_('reference label'), 'ref', searchprio=-1),
+        'label': ObjType(l_('reference label'), 'ref', 'keyword',
+                         searchprio=-1),
         'envvar': ObjType(l_('environment variable'), 'envvar'),
         'cmdoption': ObjType(l_('program option'), 'option'),
     }

File sphinx/ext/intersphinx.py

 
 from docutils import nodes
 
+from sphinx.locale import _
 from sphinx.builders.html import INVENTORY_FILENAME
 
 handlers = [urllib2.ProxyHandler(), urllib2.HTTPRedirectHandler(),
                 continue
             proj, version, uri, dispname = inventory[objtype][target]
             newnode = nodes.reference('', '', internal=False, refuri=uri,
-                                      reftitle='(in %s v%s)' % (proj, version))
+                                      reftitle=_('(in %s v%s)') % (proj, version))
             if node.get('refexplicit'):
                 # use whatever title was given
                 newnode.append(contnode)
-            elif dispname == '-':
+            elif dispname == '-' or \
+                    (domain == 'std' and node['reftype'] == 'keyword'):
                 # use whatever title was given, but strip prefix
                 title = contnode.astext()
                 if in_set and title.startswith(in_set+':'):