mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-11-02 20:30:30 -06:00
Merge pull request #7102 from tk0miya/7095_dirhtml_broken_docref
Fix #7095: dirhtml: Cross references are broken via intersphinx and :doc:
This commit is contained in:
9 files changed
+79
-1
No files matched your search
@@ -0,0 +1,4 @@
|
||||
.. _bar:
|
||||
|
||||
bar
|
||||
===
|
||||
Whitespace-only changes.
@@ -0,0 +1,4 @@
|
||||
.. _foo_1:
|
||||
|
||||
foo/foo_1
|
||||
=========
|
||||
@@ -0,0 +1,4 @@
|
||||
.. _foo_2:
|
||||
|
||||
foo/foo_2
|
||||
=========
|
||||
@@ -0,0 +1,9 @@
|
||||
.. _foo:
|
||||
|
||||
foo/index
|
||||
=========
|
||||
|
||||
.. toctree::
|
||||
|
||||
foo_1
|
||||
foo_2
|
||||
@@ -0,0 +1,9 @@
|
||||
.. _index:
|
||||
|
||||
index
|
||||
=====
|
||||
|
||||
.. toctree::
|
||||
|
||||
foo/index
|
||||
bar
|
||||
@@ -0,0 +1,47 @@
|
||||
"""
|
||||
test_build_dirhtml
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Test dirhtml builder.
|
||||
|
||||
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
import posixpath
|
||||
|
||||
import pytest
|
||||
|
||||
from sphinx.util.inventory import InventoryFile
|
||||
|
||||
|
||||
@pytest.mark.sphinx(buildername='dirhtml', testroot='builder-dirhtml')
|
||||
def test_dirhtml(app, status, warning):
|
||||
app.build()
|
||||
|
||||
assert (app.outdir / 'index.html').exists()
|
||||
assert (app.outdir / 'foo/index.html').exists()
|
||||
assert (app.outdir / 'foo/foo_1/index.html').exists()
|
||||
assert (app.outdir / 'foo/foo_2/index.html').exists()
|
||||
assert (app.outdir / 'bar/index.html').exists()
|
||||
|
||||
content = (app.outdir / 'index.html').text()
|
||||
assert 'href="foo/"' in content
|
||||
assert 'href="foo/foo_1/"' in content
|
||||
assert 'href="foo/foo_2/"' in content
|
||||
assert 'href="bar/"' in content
|
||||
|
||||
# objects.inv (refs: #7095)
|
||||
f = (app.outdir / 'objects.inv').open('rb')
|
||||
invdata = InventoryFile.load(f, 'path/to', posixpath.join)
|
||||
assert 'index' in invdata.get('std:doc')
|
||||
assert ('Python', '', 'path/to/', '-') == invdata['std:doc']['index']
|
||||
|
||||
assert 'foo/index' in invdata.get('std:doc')
|
||||
assert ('Python', '', 'path/to/foo/', '-') == invdata['std:doc']['foo/index']
|
||||
|
||||
assert 'index' in invdata.get('std:label')
|
||||
assert ('Python', '', 'path/to/#index', '-') == invdata['std:label']['index']
|
||||
|
||||
assert 'foo' in invdata.get('std:label')
|
||||
assert ('Python', '', 'path/to/foo/#foo', 'foo/index') == invdata['std:label']['foo']
|
||||
Reference in new issue
Block a user