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

This commit is contained in:
Georg Brandl
2011-09-22 18:59:54 +02:00
parent 7c6e385505
commit a7f255d2f6
3 changed files with 8 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
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.

View File

@@ -328,7 +328,8 @@ class StandardDomain(Domain):
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'),
}

View File

@@ -32,6 +32,7 @@ from os import path
from docutils import nodes
from sphinx.locale import _
from sphinx.builders.html import INVENTORY_FILENAME
handlers = [urllib2.ProxyHandler(), urllib2.HTTPRedirectHandler(),
@@ -206,11 +207,12 @@ def missing_reference(app, env, node, contnode):
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+':'):