diff --git a/CHANGES b/CHANGES index f6e4b69d2..8a06d67aa 100644 --- a/CHANGES +++ b/CHANGES @@ -56,6 +56,7 @@ Bugs fixed * #1176: Fix i18n: footnote reference number missing for auto numbered named footnote and auto symbol footnote. * PR#146,#1172: Fix ZeroDivisionError in parallel builds. Thanks to tychoish. +* #1204: Fix wrong generation of links to local intersphinx targets. * #1206: Fix i18n: gettext did not translate admonition directive's title. * #1232: Sphinx generated broken ePub files on Windows. * #1259: Guard the debug output call when emitting events; to prevent the diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py index bf528e72b..193562b26 100644 --- a/sphinx/ext/intersphinx.py +++ b/sphinx/ext/intersphinx.py @@ -33,6 +33,7 @@ from os import path import re from docutils import nodes +from docutils.utils import relative_path from sphinx.locale import _ from sphinx.builders.html import INVENTORY_FILENAME @@ -236,6 +237,9 @@ def missing_reference(app, env, node, contnode): if objtype not in inventory or target not in inventory[objtype]: continue proj, version, uri, dispname = inventory[objtype][target] + if '://' not in uri and node.get('refdoc'): + # get correct path in case of subdirectories + uri = path.join(relative_path(node['refdoc'], env.srcdir), uri) newnode = nodes.reference('', '', internal=False, refuri=uri, reftitle=_('(in %s v%s)') % (proj, version)) if node.get('refexplicit'):