mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '2.0' into 7106_enumerated_nodes_marked_as_duplicated
This commit is contained in:
commit
3ad137b8b9
1
CHANGES
1
CHANGES
@ -91,6 +91,7 @@ Bugs fixed
|
||||
* #7090: std domain: Can't assign numfig-numbers for custom container nodes
|
||||
* #7106: std domain: enumerated nodes are marked as duplicated when extensions
|
||||
call ``note_explicit_target()``
|
||||
* #7095: dirhtml: Cross references are broken via intersphinx and ``:doc:`` role
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -122,7 +122,7 @@ class InventoryFile:
|
||||
|
||||
for line in stream.read_compressed_lines():
|
||||
# be careful to handle names with embedded spaces correctly
|
||||
m = re.match(r'(?x)(.+?)\s+(\S*:\S*)\s+(-?\d+)\s+(\S+)\s+(.*)',
|
||||
m = re.match(r'(?x)(.+?)\s+(\S*:\S*)\s+(-?\d+)\s+?(\S*)\s+(.*)',
|
||||
line.rstrip())
|
||||
if not m:
|
||||
continue
|
||||
|
4
tests/roots/test-builder-dirhtml/bar.rst
Normal file
4
tests/roots/test-builder-dirhtml/bar.rst
Normal file
@ -0,0 +1,4 @@
|
||||
.. _bar:
|
||||
|
||||
bar
|
||||
===
|
0
tests/roots/test-builder-dirhtml/conf.py
Normal file
0
tests/roots/test-builder-dirhtml/conf.py
Normal file
4
tests/roots/test-builder-dirhtml/foo/foo_1.rst
Normal file
4
tests/roots/test-builder-dirhtml/foo/foo_1.rst
Normal file
@ -0,0 +1,4 @@
|
||||
.. _foo_1:
|
||||
|
||||
foo/foo_1
|
||||
=========
|
4
tests/roots/test-builder-dirhtml/foo/foo_2.rst
Normal file
4
tests/roots/test-builder-dirhtml/foo/foo_2.rst
Normal file
@ -0,0 +1,4 @@
|
||||
.. _foo_2:
|
||||
|
||||
foo/foo_2
|
||||
=========
|
9
tests/roots/test-builder-dirhtml/foo/index.rst
Normal file
9
tests/roots/test-builder-dirhtml/foo/index.rst
Normal file
@ -0,0 +1,9 @@
|
||||
.. _foo:
|
||||
|
||||
foo/index
|
||||
=========
|
||||
|
||||
.. toctree::
|
||||
|
||||
foo_1
|
||||
foo_2
|
9
tests/roots/test-builder-dirhtml/index.rst
Normal file
9
tests/roots/test-builder-dirhtml/index.rst
Normal file
@ -0,0 +1,9 @@
|
||||
.. _index:
|
||||
|
||||
index
|
||||
=====
|
||||
|
||||
.. toctree::
|
||||
|
||||
foo/index
|
||||
bar
|
47
tests/test_build_dirhtml.py
Normal file
47
tests/test_build_dirhtml.py
Normal file
@ -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']
|
Loading…
Reference in New Issue
Block a user