mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '3.x'
This commit is contained in:
@@ -50,7 +50,7 @@ give the directive option flag ``:noindexentry:``.
|
|||||||
If you want to typeset an object description, without even making it available
|
If you want to typeset an object description, without even making it available
|
||||||
for cross-referencing, you can give the directive option flag ``:noindex:``
|
for cross-referencing, you can give the directive option flag ``:noindex:``
|
||||||
(which implies ``:noindexentry:``).
|
(which implies ``:noindexentry:``).
|
||||||
Though, note that not every directive en every domain may support these
|
Though, note that not every directive in every domain may support these
|
||||||
options.
|
options.
|
||||||
|
|
||||||
.. versionadded:: 3.2
|
.. versionadded:: 3.2
|
||||||
|
|||||||
@@ -24,6 +24,12 @@ from sphinx.testing.util import strip_escseq
|
|||||||
from sphinx.util import md5
|
from sphinx.util import md5
|
||||||
from sphinx.util.inventory import InventoryFile
|
from sphinx.util.inventory import InventoryFile
|
||||||
|
|
||||||
|
if docutils.__version_info__ < (0, 17):
|
||||||
|
FIGURE_CAPTION = ".//div[@class='figure align-default']/p[@class='caption']"
|
||||||
|
else:
|
||||||
|
FIGURE_CAPTION = ".//figure/figcaption/p"
|
||||||
|
|
||||||
|
|
||||||
ENV_WARNINGS = """\
|
ENV_WARNINGS = """\
|
||||||
%(root)s/autodoc_fodder.py:docstring of autodoc_fodder.MarkupError:\\d+: \
|
%(root)s/autodoc_fodder.py:docstring of autodoc_fodder.MarkupError:\\d+: \
|
||||||
WARNING: Explicit markup ends without a blank line; unexpected unindent.
|
WARNING: Explicit markup ends without a blank line; unexpected unindent.
|
||||||
@@ -593,8 +599,7 @@ def test_numfig_disabled_warn(app, warning):
|
|||||||
|
|
||||||
@pytest.mark.parametrize("fname,expect", flat_dict({
|
@pytest.mark.parametrize("fname,expect", flat_dict({
|
||||||
'index.html': [
|
'index.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", None, True),
|
||||||
"span[@class='caption-number']", None, True),
|
|
||||||
(".//table/caption/span[@class='caption-number']", None, True),
|
(".//table/caption/span[@class='caption-number']", None, True),
|
||||||
(".//div[@class='code-block-caption']/"
|
(".//div[@class='code-block-caption']/"
|
||||||
"span[@class='caption-number']", None, True),
|
"span[@class='caption-number']", None, True),
|
||||||
@@ -610,22 +615,19 @@ def test_numfig_disabled_warn(app, warning):
|
|||||||
(".//li/p/a/span", '^Sect.1 Foo$', True),
|
(".//li/p/a/span", '^Sect.1 Foo$', True),
|
||||||
],
|
],
|
||||||
'foo.html': [
|
'foo.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", None, True),
|
||||||
"span[@class='caption-number']", None, True),
|
|
||||||
(".//table/caption/span[@class='caption-number']", None, True),
|
(".//table/caption/span[@class='caption-number']", None, True),
|
||||||
(".//div[@class='code-block-caption']/"
|
(".//div[@class='code-block-caption']/"
|
||||||
"span[@class='caption-number']", None, True),
|
"span[@class='caption-number']", None, True),
|
||||||
],
|
],
|
||||||
'bar.html': [
|
'bar.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", None, True),
|
||||||
"span[@class='caption-number']", None, True),
|
|
||||||
(".//table/caption/span[@class='caption-number']", None, True),
|
(".//table/caption/span[@class='caption-number']", None, True),
|
||||||
(".//div[@class='code-block-caption']/"
|
(".//div[@class='code-block-caption']/"
|
||||||
"span[@class='caption-number']", None, True),
|
"span[@class='caption-number']", None, True),
|
||||||
],
|
],
|
||||||
'baz.html': [
|
'baz.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", None, True),
|
||||||
"span[@class='caption-number']", None, True),
|
|
||||||
(".//table/caption/span[@class='caption-number']", None, True),
|
(".//table/caption/span[@class='caption-number']", None, True),
|
||||||
(".//div[@class='code-block-caption']/"
|
(".//div[@class='code-block-caption']/"
|
||||||
"span[@class='caption-number']", None, True),
|
"span[@class='caption-number']", None, True),
|
||||||
@@ -659,10 +661,8 @@ def test_numfig_without_numbered_toctree_warn(app, warning):
|
|||||||
|
|
||||||
@pytest.mark.parametrize("fname,expect", flat_dict({
|
@pytest.mark.parametrize("fname,expect", flat_dict({
|
||||||
'index.html': [
|
'index.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 9 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 9 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 10 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Fig. 10 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Table 9 $', True),
|
'^Table 9 $', True),
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
@@ -683,14 +683,10 @@ def test_numfig_without_numbered_toctree_warn(app, warning):
|
|||||||
(".//li/p/code/span", '^Sect.{number}$', True),
|
(".//li/p/code/span", '^Sect.{number}$', True),
|
||||||
],
|
],
|
||||||
'foo.html': [
|
'foo.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 1 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 3 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 2 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 4 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Fig. 3 $', True),
|
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Fig. 4 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Table 1 $', True),
|
'^Table 1 $', True),
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
@@ -709,12 +705,9 @@ def test_numfig_without_numbered_toctree_warn(app, warning):
|
|||||||
"span[@class='caption-number']", '^Listing 4 $', True),
|
"span[@class='caption-number']", '^Listing 4 $', True),
|
||||||
],
|
],
|
||||||
'bar.html': [
|
'bar.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 5 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 5 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 7 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 8 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 7 $', True),
|
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Fig. 8 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Table 5 $', True),
|
'^Table 5 $', True),
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
@@ -729,8 +722,7 @@ def test_numfig_without_numbered_toctree_warn(app, warning):
|
|||||||
"span[@class='caption-number']", '^Listing 8 $', True),
|
"span[@class='caption-number']", '^Listing 8 $', True),
|
||||||
],
|
],
|
||||||
'baz.html': [
|
'baz.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 6 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 6 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Table 6 $', True),
|
'^Table 6 $', True),
|
||||||
(".//div[@class='code-block-caption']/"
|
(".//div[@class='code-block-caption']/"
|
||||||
@@ -765,10 +757,8 @@ def test_numfig_with_numbered_toctree_warn(app, warning):
|
|||||||
|
|
||||||
@pytest.mark.parametrize("fname,expect", flat_dict({
|
@pytest.mark.parametrize("fname,expect", flat_dict({
|
||||||
'index.html': [
|
'index.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 1 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Fig. 2 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Table 1 $', True),
|
'^Table 1 $', True),
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
@@ -789,14 +779,10 @@ def test_numfig_with_numbered_toctree_warn(app, warning):
|
|||||||
(".//li/p/a/span", '^Sect.1 Foo$', True),
|
(".//li/p/a/span", '^Sect.1 Foo$', True),
|
||||||
],
|
],
|
||||||
'foo.html': [
|
'foo.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.1 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 1.1 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.2 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.3 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 1.2 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.4 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Fig. 1.3 $', True),
|
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Fig. 1.4 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Table 1.1 $', True),
|
'^Table 1.1 $', True),
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
@@ -815,12 +801,9 @@ def test_numfig_with_numbered_toctree_warn(app, warning):
|
|||||||
"span[@class='caption-number']", '^Listing 1.4 $', True),
|
"span[@class='caption-number']", '^Listing 1.4 $', True),
|
||||||
],
|
],
|
||||||
'bar.html': [
|
'bar.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.1 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 2.1 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.3 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.4 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 2.3 $', True),
|
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Fig. 2.4 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Table 2.1 $', True),
|
'^Table 2.1 $', True),
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
@@ -835,8 +818,7 @@ def test_numfig_with_numbered_toctree_warn(app, warning):
|
|||||||
"span[@class='caption-number']", '^Listing 2.4 $', True),
|
"span[@class='caption-number']", '^Listing 2.4 $', True),
|
||||||
],
|
],
|
||||||
'baz.html': [
|
'baz.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.2 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 2.2 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Table 2.2 $', True),
|
'^Table 2.2 $', True),
|
||||||
(".//div[@class='code-block-caption']/"
|
(".//div[@class='code-block-caption']/"
|
||||||
@@ -868,10 +850,8 @@ def test_numfig_with_prefix_warn(app, warning):
|
|||||||
|
|
||||||
@pytest.mark.parametrize("fname,expect", flat_dict({
|
@pytest.mark.parametrize("fname,expect", flat_dict({
|
||||||
'index.html': [
|
'index.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:1 $', True),
|
||||||
"span[@class='caption-number']", '^Figure:1 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:2 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Figure:2 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Tab_1 $', True),
|
'^Tab_1 $', True),
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
@@ -892,14 +872,10 @@ def test_numfig_with_prefix_warn(app, warning):
|
|||||||
(".//li/p/a/span", '^Sect.1 Foo$', True),
|
(".//li/p/a/span", '^Sect.1 Foo$', True),
|
||||||
],
|
],
|
||||||
'foo.html': [
|
'foo.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:1.1 $', True),
|
||||||
"span[@class='caption-number']", '^Figure:1.1 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:1.2 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:1.3 $', True),
|
||||||
"span[@class='caption-number']", '^Figure:1.2 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:1.4 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Figure:1.3 $', True),
|
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Figure:1.4 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Tab_1.1 $', True),
|
'^Tab_1.1 $', True),
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
@@ -918,12 +894,9 @@ def test_numfig_with_prefix_warn(app, warning):
|
|||||||
"span[@class='caption-number']", '^Code-1.4 $', True),
|
"span[@class='caption-number']", '^Code-1.4 $', True),
|
||||||
],
|
],
|
||||||
'bar.html': [
|
'bar.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:2.1 $', True),
|
||||||
"span[@class='caption-number']", '^Figure:2.1 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:2.3 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:2.4 $', True),
|
||||||
"span[@class='caption-number']", '^Figure:2.3 $', True),
|
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Figure:2.4 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Tab_2.1 $', True),
|
'^Tab_2.1 $', True),
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
@@ -938,8 +911,7 @@ def test_numfig_with_prefix_warn(app, warning):
|
|||||||
"span[@class='caption-number']", '^Code-2.4 $', True),
|
"span[@class='caption-number']", '^Code-2.4 $', True),
|
||||||
],
|
],
|
||||||
'baz.html': [
|
'baz.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:2.2 $', True),
|
||||||
"span[@class='caption-number']", '^Figure:2.2 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Tab_2.2 $', True),
|
'^Tab_2.2 $', True),
|
||||||
(".//div[@class='code-block-caption']/"
|
(".//div[@class='code-block-caption']/"
|
||||||
@@ -972,10 +944,8 @@ def test_numfig_with_secnum_depth_warn(app, warning):
|
|||||||
|
|
||||||
@pytest.mark.parametrize("fname,expect", flat_dict({
|
@pytest.mark.parametrize("fname,expect", flat_dict({
|
||||||
'index.html': [
|
'index.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 1 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Fig. 2 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Table 1 $', True),
|
'^Table 1 $', True),
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
@@ -996,14 +966,10 @@ def test_numfig_with_secnum_depth_warn(app, warning):
|
|||||||
(".//li/p/a/span", '^Sect.1 Foo$', True),
|
(".//li/p/a/span", '^Sect.1 Foo$', True),
|
||||||
],
|
],
|
||||||
'foo.html': [
|
'foo.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.1 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 1.1 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.1.1 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.1.2 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 1.1.1 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.2.1 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Fig. 1.1.2 $', True),
|
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Fig. 1.2.1 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Table 1.1 $', True),
|
'^Table 1.1 $', True),
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
@@ -1022,12 +988,9 @@ def test_numfig_with_secnum_depth_warn(app, warning):
|
|||||||
"span[@class='caption-number']", '^Listing 1.2.1 $', True),
|
"span[@class='caption-number']", '^Listing 1.2.1 $', True),
|
||||||
],
|
],
|
||||||
'bar.html': [
|
'bar.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.1.1 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 2.1.1 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.1.3 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.2.1 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 2.1.3 $', True),
|
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Fig. 2.2.1 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Table 2.1.1 $', True),
|
'^Table 2.1.1 $', True),
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
@@ -1042,8 +1005,7 @@ def test_numfig_with_secnum_depth_warn(app, warning):
|
|||||||
"span[@class='caption-number']", '^Listing 2.2.1 $', True),
|
"span[@class='caption-number']", '^Listing 2.2.1 $', True),
|
||||||
],
|
],
|
||||||
'baz.html': [
|
'baz.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.1.2 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 2.1.2 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Table 2.1.2 $', True),
|
'^Table 2.1.2 $', True),
|
||||||
(".//div[@class='code-block-caption']/"
|
(".//div[@class='code-block-caption']/"
|
||||||
@@ -1061,10 +1023,8 @@ def test_numfig_with_secnum_depth(app, cached_etree_parse, fname, expect):
|
|||||||
|
|
||||||
@pytest.mark.parametrize("fname,expect", flat_dict({
|
@pytest.mark.parametrize("fname,expect", flat_dict({
|
||||||
'index.html': [
|
'index.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 1 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Fig. 2 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Table 1 $', True),
|
'^Table 1 $', True),
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
@@ -1083,14 +1043,10 @@ def test_numfig_with_secnum_depth(app, cached_etree_parse, fname, expect):
|
|||||||
(".//li/p/a/span", '^Section.2.1$', True),
|
(".//li/p/a/span", '^Section.2.1$', True),
|
||||||
(".//li/p/a/span", '^Fig.1 should be Fig.1$', True),
|
(".//li/p/a/span", '^Fig.1 should be Fig.1$', True),
|
||||||
(".//li/p/a/span", '^Sect.1 Foo$', True),
|
(".//li/p/a/span", '^Sect.1 Foo$', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.1 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 1.1 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.2 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.3 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 1.2 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.4 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Fig. 1.3 $', True),
|
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Fig. 1.4 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Table 1.1 $', True),
|
'^Table 1.1 $', True),
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
@@ -1107,12 +1063,9 @@ def test_numfig_with_secnum_depth(app, cached_etree_parse, fname, expect):
|
|||||||
"span[@class='caption-number']", '^Listing 1.3 $', True),
|
"span[@class='caption-number']", '^Listing 1.3 $', True),
|
||||||
(".//div[@class='code-block-caption']/"
|
(".//div[@class='code-block-caption']/"
|
||||||
"span[@class='caption-number']", '^Listing 1.4 $', True),
|
"span[@class='caption-number']", '^Listing 1.4 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.1 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 2.1 $', True),
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.3 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.4 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 2.3 $', True),
|
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
|
||||||
"span[@class='caption-number']", '^Fig. 2.4 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Table 2.1 $', True),
|
'^Table 2.1 $', True),
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
@@ -1125,8 +1078,7 @@ def test_numfig_with_secnum_depth(app, cached_etree_parse, fname, expect):
|
|||||||
"span[@class='caption-number']", '^Listing 2.3 $', True),
|
"span[@class='caption-number']", '^Listing 2.3 $', True),
|
||||||
(".//div[@class='code-block-caption']/"
|
(".//div[@class='code-block-caption']/"
|
||||||
"span[@class='caption-number']", '^Listing 2.4 $', True),
|
"span[@class='caption-number']", '^Listing 2.4 $', True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']/"
|
(FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.2 $', True),
|
||||||
"span[@class='caption-number']", '^Fig. 2.2 $', True),
|
|
||||||
(".//table/caption/span[@class='caption-number']",
|
(".//table/caption/span[@class='caption-number']",
|
||||||
'^Table 2.2 $', True),
|
'^Table 2.2 $', True),
|
||||||
(".//div[@class='code-block-caption']/"
|
(".//div[@class='code-block-caption']/"
|
||||||
@@ -1142,12 +1094,9 @@ def test_numfig_with_singlehtml(app, cached_etree_parse, fname, expect):
|
|||||||
|
|
||||||
@pytest.mark.parametrize("fname,expect", flat_dict({
|
@pytest.mark.parametrize("fname,expect", flat_dict({
|
||||||
'index.html': [
|
'index.html': [
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']"
|
(FIGURE_CAPTION + "//span[@class='caption-number']", "Fig. 1", True),
|
||||||
"/span[@class='caption-number']", "Fig. 1", True),
|
(FIGURE_CAPTION + "//span[@class='caption-number']", "Fig. 2", True),
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']"
|
(FIGURE_CAPTION + "//span[@class='caption-number']", "Fig. 3", True),
|
||||||
"/span[@class='caption-number']", "Fig. 2", True),
|
|
||||||
(".//div[@class='figure align-default']/p[@class='caption']"
|
|
||||||
"/span[@class='caption-number']", "Fig. 3", True),
|
|
||||||
(".//div//span[@class='caption-number']", "No.1 ", True),
|
(".//div//span[@class='caption-number']", "No.1 ", True),
|
||||||
(".//div//span[@class='caption-number']", "No.2 ", True),
|
(".//div//span[@class='caption-number']", "No.2 ", True),
|
||||||
(".//li/p/a/span", 'Fig. 1', True),
|
(".//li/p/a/span", 'Fig. 1', True),
|
||||||
@@ -1308,9 +1257,14 @@ def test_html_inventory(app):
|
|||||||
def test_html_anchor_for_figure(app):
|
def test_html_anchor_for_figure(app):
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
content = (app.outdir / 'index.html').read_text()
|
content = (app.outdir / 'index.html').read_text()
|
||||||
|
if docutils.__version_info__ < (0, 17):
|
||||||
assert ('<p class="caption"><span class="caption-text">The caption of pic</span>'
|
assert ('<p class="caption"><span class="caption-text">The caption of pic</span>'
|
||||||
'<a class="headerlink" href="#id1" title="Permalink to this image">¶</a></p>'
|
'<a class="headerlink" href="#id1" title="Permalink to this image">¶</a></p>'
|
||||||
in content)
|
in content)
|
||||||
|
else:
|
||||||
|
assert ('<figcaption>\n<p><span class="caption-text">The caption of pic</span>'
|
||||||
|
'<a class="headerlink" href="#id1" title="Permalink to this image">¶</a></p>\n</figcaption>'
|
||||||
|
in content)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('html', testroot='directives-raw')
|
@pytest.mark.sphinx('html', testroot='directives-raw')
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ def test_mangle_signature():
|
|||||||
|
|
||||||
|
|
||||||
def test_extract_summary(capsys):
|
def test_extract_summary(capsys):
|
||||||
settings = Mock(language_code='',
|
settings = Mock(language_code='en',
|
||||||
id_prefix='',
|
id_prefix='',
|
||||||
auto_id_prefix='',
|
auto_id_prefix='',
|
||||||
pep_reference=False,
|
pep_reference=False,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import re
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from sphinx.ext.graphviz import ClickableMapDefinition
|
from sphinx.ext.graphviz import ClickableMapDefinition
|
||||||
|
from sphinx.util import docutils
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('html', testroot='ext-graphviz')
|
@pytest.mark.sphinx('html', testroot='ext-graphviz')
|
||||||
@@ -21,9 +22,15 @@ def test_graphviz_png_html(app, status, warning):
|
|||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
|
|
||||||
content = (app.outdir / 'index.html').read_text()
|
content = (app.outdir / 'index.html').read_text()
|
||||||
|
if docutils.__version_info__ < (0, 17):
|
||||||
html = (r'<div class="figure align-default" .*?>\s*'
|
html = (r'<div class="figure align-default" .*?>\s*'
|
||||||
r'<div class="graphviz"><img .*?/></div>\s*<p class="caption">'
|
r'<div class="graphviz"><img .*?/></div>\s*<p class="caption">'
|
||||||
r'<span class="caption-text">caption of graph</span>.*</p>\s*</div>')
|
r'<span class="caption-text">caption of graph</span>.*</p>\s*</div>')
|
||||||
|
else:
|
||||||
|
html = (r'<figure class="align-default" .*?>\s*'
|
||||||
|
r'<div class="graphviz"><img .*?/></div>\s*<figcaption>\s*'
|
||||||
|
r'<p><span class="caption-text">caption of graph</span>.*</p>\s*'
|
||||||
|
r'</figcaption>\s*</figure>')
|
||||||
assert re.search(html, content, re.S)
|
assert re.search(html, content, re.S)
|
||||||
|
|
||||||
html = 'Hello <div class="graphviz"><img .*?/></div>\n graphviz world'
|
html = 'Hello <div class="graphviz"><img .*?/></div>\n graphviz world'
|
||||||
@@ -33,9 +40,15 @@ def test_graphviz_png_html(app, status, warning):
|
|||||||
'class="graphviz neato-graph" />')
|
'class="graphviz neato-graph" />')
|
||||||
assert re.search(html, content, re.S)
|
assert re.search(html, content, re.S)
|
||||||
|
|
||||||
|
if docutils.__version_info__ < (0, 17):
|
||||||
html = (r'<div class="figure align-right" .*?>\s*'
|
html = (r'<div class="figure align-right" .*?>\s*'
|
||||||
r'<div class="graphviz"><img .*?/></div>\s*<p class="caption">'
|
r'<div class="graphviz"><img .*?/></div>\s*<p class="caption">'
|
||||||
r'<span class="caption-text">on <em>right</em></span>.*</p>\s*</div>')
|
r'<span class="caption-text">on <em>right</em></span>.*</p>\s*</div>')
|
||||||
|
else:
|
||||||
|
html = (r'<figure class="align-right" .*?>\s*'
|
||||||
|
r'<div class="graphviz"><img .*?/></div>\s*<figcaption>\s*'
|
||||||
|
r'<p><span class="caption-text">on <em>right</em></span>.*</p>\s*'
|
||||||
|
r'</figcaption>\s*</figure>')
|
||||||
assert re.search(html, content, re.S)
|
assert re.search(html, content, re.S)
|
||||||
|
|
||||||
html = (r'<div align=\"center\" class=\"align-center\">'
|
html = (r'<div align=\"center\" class=\"align-center\">'
|
||||||
@@ -53,6 +66,7 @@ def test_graphviz_svg_html(app, status, warning):
|
|||||||
|
|
||||||
content = (app.outdir / 'index.html').read_text()
|
content = (app.outdir / 'index.html').read_text()
|
||||||
|
|
||||||
|
if docutils.__version_info__ < (0, 17):
|
||||||
html = (r'<div class=\"figure align-default\" .*?>\n'
|
html = (r'<div class=\"figure align-default\" .*?>\n'
|
||||||
r'<div class="graphviz"><object data=\".*\.svg\".*>\n'
|
r'<div class="graphviz"><object data=\".*\.svg\".*>\n'
|
||||||
r'\s*<p class=\"warning\">digraph foo {\n'
|
r'\s*<p class=\"warning\">digraph foo {\n'
|
||||||
@@ -60,6 +74,16 @@ def test_graphviz_svg_html(app, status, warning):
|
|||||||
r'}</p></object></div>\n'
|
r'}</p></object></div>\n'
|
||||||
r'<p class=\"caption\"><span class=\"caption-text\">'
|
r'<p class=\"caption\"><span class=\"caption-text\">'
|
||||||
r'caption of graph</span>.*</p>\n</div>')
|
r'caption of graph</span>.*</p>\n</div>')
|
||||||
|
else:
|
||||||
|
html = (r'<figure class=\"align-default\" .*?>\n'
|
||||||
|
r'<div class="graphviz"><object data=\".*\.svg\".*>\n'
|
||||||
|
r'\s*<p class=\"warning\">digraph foo {\n'
|
||||||
|
r'bar -> baz\n'
|
||||||
|
r'}</p></object></div>\n'
|
||||||
|
r'<figcaption>\n'
|
||||||
|
r'<p><span class=\"caption-text\">caption of graph</span>.*</p>\n'
|
||||||
|
r'</figcaption>\n'
|
||||||
|
r'</figure>')
|
||||||
assert re.search(html, content, re.S)
|
assert re.search(html, content, re.S)
|
||||||
|
|
||||||
html = (r'Hello <div class="graphviz"><object.*>\n'
|
html = (r'Hello <div class="graphviz"><object.*>\n'
|
||||||
@@ -67,6 +91,7 @@ def test_graphviz_svg_html(app, status, warning):
|
|||||||
r' graphviz world')
|
r' graphviz world')
|
||||||
assert re.search(html, content, re.S)
|
assert re.search(html, content, re.S)
|
||||||
|
|
||||||
|
if docutils.__version_info__ < (0, 17):
|
||||||
html = (r'<div class=\"figure align-right\" .*\>\n'
|
html = (r'<div class=\"figure align-right\" .*\>\n'
|
||||||
r'<div class="graphviz"><object data=\".*\.svg\".*>\n'
|
r'<div class="graphviz"><object data=\".*\.svg\".*>\n'
|
||||||
r'\s*<p class=\"warning\">digraph bar {\n'
|
r'\s*<p class=\"warning\">digraph bar {\n'
|
||||||
@@ -75,6 +100,16 @@ def test_graphviz_svg_html(app, status, warning):
|
|||||||
r'<p class=\"caption\"><span class=\"caption-text\">'
|
r'<p class=\"caption\"><span class=\"caption-text\">'
|
||||||
r'on <em>right</em></span>.*</p>\n'
|
r'on <em>right</em></span>.*</p>\n'
|
||||||
r'</div>')
|
r'</div>')
|
||||||
|
else:
|
||||||
|
html = (r'<figure class=\"align-right\" .*\>\n'
|
||||||
|
r'<div class="graphviz"><object data=\".*\.svg\".*>\n'
|
||||||
|
r'\s*<p class=\"warning\">digraph bar {\n'
|
||||||
|
r'foo -> bar\n'
|
||||||
|
r'}</p></object></div>\n'
|
||||||
|
r'<figcaption>\n'
|
||||||
|
r'<p><span class=\"caption-text\">on <em>right</em></span>.*</p>\n'
|
||||||
|
r'</figcaption>\n'
|
||||||
|
r'</figure>')
|
||||||
assert re.search(html, content, re.S)
|
assert re.search(html, content, re.S)
|
||||||
|
|
||||||
html = (r'<div align=\"center\" class=\"align-center\">'
|
html = (r'<div align=\"center\" class=\"align-center\">'
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import pytest
|
|||||||
|
|
||||||
from sphinx.ext.inheritance_diagram import (InheritanceDiagram, InheritanceException,
|
from sphinx.ext.inheritance_diagram import (InheritanceDiagram, InheritanceException,
|
||||||
import_classes)
|
import_classes)
|
||||||
|
from sphinx.util import docutils
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx(buildername="html", testroot="inheritance")
|
@pytest.mark.sphinx(buildername="html", testroot="inheritance")
|
||||||
@@ -147,12 +148,20 @@ def test_inheritance_diagram_png_html(app, status, warning):
|
|||||||
|
|
||||||
content = (app.outdir / 'index.html').read_text()
|
content = (app.outdir / 'index.html').read_text()
|
||||||
|
|
||||||
|
if docutils.__version_info__ < (0, 17):
|
||||||
pattern = ('<div class="figure align-default" id="id1">\n'
|
pattern = ('<div class="figure align-default" id="id1">\n'
|
||||||
'<div class="graphviz">'
|
'<div class="graphviz">'
|
||||||
'<img src="_images/inheritance-\\w+.png" alt="Inheritance diagram of test.Foo" '
|
'<img src="_images/inheritance-\\w+.png" alt="Inheritance diagram of test.Foo" '
|
||||||
'class="inheritance graphviz" /></div>\n<p class="caption">'
|
'class="inheritance graphviz" /></div>\n<p class="caption">'
|
||||||
'<span class="caption-text">Test Foo!</span><a class="headerlink" href="#id1" '
|
'<span class="caption-text">Test Foo!</span><a class="headerlink" href="#id1" '
|
||||||
'title="Permalink to this image">\xb6</a></p>')
|
'title="Permalink to this image">\xb6</a></p>\n</div>\n')
|
||||||
|
else:
|
||||||
|
pattern = ('<figure class="align-default" id="id1">\n'
|
||||||
|
'<div class="graphviz">'
|
||||||
|
'<img src="_images/inheritance-\\w+.png" alt="Inheritance diagram of test.Foo" '
|
||||||
|
'class="inheritance graphviz" /></div>\n<figcaption>\n<p>'
|
||||||
|
'<span class="caption-text">Test Foo!</span><a class="headerlink" href="#id1" '
|
||||||
|
'title="Permalink to this image">\xb6</a></p>\n</figcaption>\n</figure>\n')
|
||||||
assert re.search(pattern, content, re.M)
|
assert re.search(pattern, content, re.M)
|
||||||
|
|
||||||
|
|
||||||
@@ -164,6 +173,7 @@ def test_inheritance_diagram_svg_html(app, status, warning):
|
|||||||
|
|
||||||
content = (app.outdir / 'index.html').read_text()
|
content = (app.outdir / 'index.html').read_text()
|
||||||
|
|
||||||
|
if docutils.__version_info__ < (0, 17):
|
||||||
pattern = ('<div class="figure align-default" id="id1">\n'
|
pattern = ('<div class="figure align-default" id="id1">\n'
|
||||||
'<div class="graphviz">'
|
'<div class="graphviz">'
|
||||||
'<object data="_images/inheritance-\\w+.svg" '
|
'<object data="_images/inheritance-\\w+.svg" '
|
||||||
@@ -171,7 +181,17 @@ def test_inheritance_diagram_svg_html(app, status, warning):
|
|||||||
'<p class=\"warning\">Inheritance diagram of test.Foo</p>'
|
'<p class=\"warning\">Inheritance diagram of test.Foo</p>'
|
||||||
'</object></div>\n<p class="caption"><span class="caption-text">'
|
'</object></div>\n<p class="caption"><span class="caption-text">'
|
||||||
'Test Foo!</span><a class="headerlink" href="#id1" '
|
'Test Foo!</span><a class="headerlink" href="#id1" '
|
||||||
'title="Permalink to this image">\xb6</a></p>')
|
'title="Permalink to this image">\xb6</a></p>\n</div>\n')
|
||||||
|
else:
|
||||||
|
pattern = ('<figure class="align-default" id="id1">\n'
|
||||||
|
'<div class="graphviz">'
|
||||||
|
'<object data="_images/inheritance-\\w+.svg" '
|
||||||
|
'type="image/svg\\+xml" class="inheritance graphviz">\n'
|
||||||
|
'<p class=\"warning\">Inheritance diagram of test.Foo</p>'
|
||||||
|
'</object></div>\n<figcaption>\n<p><span class="caption-text">'
|
||||||
|
'Test Foo!</span><a class="headerlink" href="#id1" '
|
||||||
|
'title="Permalink to this image">\xb6</a></p>\n</figcaption>\n</figure>\n')
|
||||||
|
|
||||||
assert re.search(pattern, content, re.M)
|
assert re.search(pattern, content, re.M)
|
||||||
|
|
||||||
|
|
||||||
@@ -204,12 +224,20 @@ def test_inheritance_diagram_latex_alias(app, status, warning):
|
|||||||
|
|
||||||
content = (app.outdir / 'index.html').read_text()
|
content = (app.outdir / 'index.html').read_text()
|
||||||
|
|
||||||
|
if docutils.__version_info__ < (0, 17):
|
||||||
pattern = ('<div class="figure align-default" id="id1">\n'
|
pattern = ('<div class="figure align-default" id="id1">\n'
|
||||||
'<div class="graphviz">'
|
'<div class="graphviz">'
|
||||||
'<img src="_images/inheritance-\\w+.png" alt="Inheritance diagram of test.Foo" '
|
'<img src="_images/inheritance-\\w+.png" alt="Inheritance diagram of test.Foo" '
|
||||||
'class="inheritance graphviz" /></div>\n<p class="caption">'
|
'class="inheritance graphviz" /></div>\n<p class="caption">'
|
||||||
'<span class="caption-text">Test Foo!</span><a class="headerlink" href="#id1" '
|
'<span class="caption-text">Test Foo!</span><a class="headerlink" href="#id1" '
|
||||||
'title="Permalink to this image">\xb6</a></p>')
|
'title="Permalink to this image">\xb6</a></p>\n</div>\n')
|
||||||
|
else:
|
||||||
|
pattern = ('<figure class="align-default" id="id1">\n'
|
||||||
|
'<div class="graphviz">'
|
||||||
|
'<img src="_images/inheritance-\\w+.png" alt="Inheritance diagram of test.Foo" '
|
||||||
|
'class="inheritance graphviz" /></div>\n<figcaption>\n<p>'
|
||||||
|
'<span class="caption-text">Test Foo!</span><a class="headerlink" href="#id1" '
|
||||||
|
'title="Permalink to this image">\xb6</a></p>\n</figcaption>\n</figure>\n')
|
||||||
assert re.search(pattern, content, re.M)
|
assert re.search(pattern, content, re.M)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ from docutils import nodes
|
|||||||
from sphinx import locale
|
from sphinx import locale
|
||||||
from sphinx.testing.util import (assert_node, assert_not_re_search, assert_re_search,
|
from sphinx.testing.util import (assert_node, assert_not_re_search, assert_re_search,
|
||||||
assert_startswith, etree_parse, path, strip_escseq)
|
assert_startswith, etree_parse, path, strip_escseq)
|
||||||
|
from sphinx.util import docutils
|
||||||
|
|
||||||
sphinx_intl = pytest.mark.sphinx(
|
sphinx_intl = pytest.mark.sphinx(
|
||||||
testroot='intl',
|
testroot='intl',
|
||||||
@@ -621,8 +622,11 @@ def test_html_meta(app):
|
|||||||
assert expected_expr in result
|
assert expected_expr in result
|
||||||
expected_expr = '<meta content="I18N, SPHINX, MARKUP" name="keywords" />'
|
expected_expr = '<meta content="I18N, SPHINX, MARKUP" name="keywords" />'
|
||||||
assert expected_expr in result
|
assert expected_expr in result
|
||||||
|
if docutils.__version_info__ < (0, 17):
|
||||||
expected_expr = '<p class="caption"><span class="caption-text">HIDDEN TOC</span></p>'
|
expected_expr = '<p class="caption"><span class="caption-text">HIDDEN TOC</span></p>'
|
||||||
assert expected_expr in result
|
assert expected_expr in result
|
||||||
|
else:
|
||||||
|
expected_expr = '<p><span class="caption-text">HIDDEN TOC</span></p>'
|
||||||
|
|
||||||
|
|
||||||
@sphinx_intl
|
@sphinx_intl
|
||||||
@@ -1083,8 +1087,12 @@ def test_additional_targets_should_not_be_translated(app):
|
|||||||
result = (app.outdir / 'raw.html').read_text()
|
result = (app.outdir / 'raw.html').read_text()
|
||||||
|
|
||||||
# raw block should not be translated
|
# raw block should not be translated
|
||||||
|
if docutils.__version_info__ < (0, 17):
|
||||||
expected_expr = """<iframe src="http://sphinx-doc.org"></iframe></div>"""
|
expected_expr = """<iframe src="http://sphinx-doc.org"></iframe></div>"""
|
||||||
assert_count(expected_expr, result, 1)
|
assert_count(expected_expr, result, 1)
|
||||||
|
else:
|
||||||
|
expected_expr = """<iframe src="http://sphinx-doc.org"></iframe></section>"""
|
||||||
|
assert_count(expected_expr, result, 1)
|
||||||
|
|
||||||
# [figure.txt]
|
# [figure.txt]
|
||||||
|
|
||||||
@@ -1157,8 +1165,12 @@ def test_additional_targets_should_be_translated(app):
|
|||||||
result = (app.outdir / 'raw.html').read_text()
|
result = (app.outdir / 'raw.html').read_text()
|
||||||
|
|
||||||
# raw block should be translated
|
# raw block should be translated
|
||||||
|
if docutils.__version_info__ < (0, 17):
|
||||||
expected_expr = """<iframe src="HTTP://SPHINX-DOC.ORG"></iframe></div>"""
|
expected_expr = """<iframe src="HTTP://SPHINX-DOC.ORG"></iframe></div>"""
|
||||||
assert_count(expected_expr, result, 1)
|
assert_count(expected_expr, result, 1)
|
||||||
|
else:
|
||||||
|
expected_expr = """<iframe src="HTTP://SPHINX-DOC.ORG"></iframe></section>"""
|
||||||
|
assert_count(expected_expr, result, 1)
|
||||||
|
|
||||||
# [figure.txt]
|
# [figure.txt]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user