mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Assign fignum to tables and code-blocks
This commit is contained in:
parent
cffec13355
commit
7cd470f59a
@ -72,7 +72,10 @@ class Config(object):
|
||||
nitpick_ignore = ([], 'html'),
|
||||
numfig = (False, 'env'),
|
||||
numfig_secnum_depth = (1, 'env'),
|
||||
numfig_prefix = ({'figure': 'Fig.'}, 'env'),
|
||||
numfig_prefix = ({'figure': 'Fig.',
|
||||
'table': 'Table ',
|
||||
'code-block': 'List '},
|
||||
'env'),
|
||||
|
||||
# HTML options
|
||||
html_theme = ('default', 'html'),
|
||||
|
@ -234,7 +234,8 @@ class BuildEnvironment:
|
||||
# used to determine when to show the TOC
|
||||
# in a sidebar (don't show if it's only one item)
|
||||
self.toc_secnumbers = {} # docname -> dict of sectionid -> number
|
||||
self.toc_fignumbers = {} # docname -> dict of figureid -> number
|
||||
self.toc_fignumbers = {} # docname -> dict of figtype ->
|
||||
# dict of figureid -> number
|
||||
|
||||
self.toctree_includes = {} # docname -> list of toctree includefiles
|
||||
self.files_to_rebuild = {} # docname -> set of files
|
||||
@ -1704,6 +1705,13 @@ class BuildEnvironment:
|
||||
self.toc_fignumbers = {}
|
||||
fignum_counter = {}
|
||||
|
||||
def has_child(node, cls):
|
||||
for child in node:
|
||||
if isinstance(child, cls):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def get_section_number(docname, section):
|
||||
anchorname = '#' + section['ids'][0]
|
||||
secnumbers = self.toc_secnumbers.get(docname, {})
|
||||
@ -1714,13 +1722,19 @@ class BuildEnvironment:
|
||||
|
||||
return secnum or tuple()
|
||||
|
||||
def get_next_figure_number(secnum):
|
||||
def get_next_fignumber(figtype, secnum):
|
||||
counter = fignum_counter.setdefault(figtype, {})
|
||||
|
||||
secnum = secnum[:self.config.numfig_secnum_depth]
|
||||
fignum_counter[secnum] = fignum_counter.get(secnum, 0) + 1
|
||||
return secnum + (fignum_counter[secnum],)
|
||||
counter[secnum] = counter.get(secnum, 0) + 1
|
||||
return secnum + (counter[secnum],)
|
||||
|
||||
def register_fignumber(docname, secnum, figtype, figure_id):
|
||||
self.toc_fignumbers.setdefault(docname, {})
|
||||
fignumbers = self.toc_fignumbers[docname].setdefault(figtype, {})
|
||||
fignumbers[figure_id] = get_next_fignumber(figtype, secnum)
|
||||
|
||||
def _walk_doctree(docname, doctree, secnum):
|
||||
fignums = self.toc_fignumbers.setdefault(docname, {})
|
||||
for subnode in doctree.children:
|
||||
if isinstance(subnode, nodes.section):
|
||||
next_secnum = get_section_number(docname, subnode)
|
||||
@ -1741,7 +1755,14 @@ class BuildEnvironment:
|
||||
|
||||
if isinstance(subnode, nodes.figure):
|
||||
figure_id = subnode['ids'][0]
|
||||
fignums[figure_id] = get_next_figure_number(secnum)
|
||||
register_fignumber(docname, secnum, 'figure', figure_id)
|
||||
elif isinstance(subnode, nodes.table):
|
||||
table_id = subnode['ids'][0]
|
||||
register_fignumber(docname, secnum, 'table', table_id)
|
||||
elif isinstance(subnode, nodes.container):
|
||||
if has_child(subnode, nodes.literal_block):
|
||||
code_block_id = subnode['ids'][0]
|
||||
register_fignumber(docname, secnum, 'code-block', code_block_id)
|
||||
|
||||
_walk_doctree(docname, subnode, secnum)
|
||||
|
||||
|
@ -122,6 +122,12 @@ class AutoNumbering(Transform):
|
||||
elif isinstance(node, nodes.image):
|
||||
if has_child(node.parent, nodes.caption):
|
||||
self.document.note_implicit_target(node.parent)
|
||||
elif isinstance(node, nodes.table):
|
||||
if has_child(node, nodes.title):
|
||||
self.document.note_implicit_target(node)
|
||||
elif isinstance(node, nodes.literal_block):
|
||||
if has_child(node.parent, nodes.caption):
|
||||
self.document.note_implicit_target(node.parent)
|
||||
|
||||
|
||||
class SortIds(Transform):
|
||||
|
@ -251,13 +251,19 @@ class HTMLTranslator(BaseTranslator):
|
||||
self.secnumber_suffix)
|
||||
|
||||
def add_fignumber(self, node):
|
||||
if isinstance(node.parent, nodes.figure):
|
||||
figure_id = node.parent['ids'][0]
|
||||
if self.builder.fignumbers.get(figure_id):
|
||||
prefix = self.builder.config.numfig_prefix.get('figure')
|
||||
numbers = self.builder.fignumbers[figure_id]
|
||||
def append_fignumber(figtype, figure_id):
|
||||
if figure_id in self.builder.fignumbers.get(figtype, {}):
|
||||
prefix = self.builder.config.numfig_prefix.get(figtype, '')
|
||||
numbers = self.builder.fignumbers[figtype][figure_id]
|
||||
self.body.append(prefix + '.'.join(map(str, numbers)) + " ")
|
||||
|
||||
if isinstance(node.parent, nodes.figure):
|
||||
append_fignumber('figure', node.parent['ids'][0])
|
||||
elif isinstance(node.parent, nodes.table):
|
||||
append_fignumber('table', node.parent['ids'][0])
|
||||
elif isinstance(node.parent, nodes.container):
|
||||
append_fignumber('code-block', node.parent['ids'][0])
|
||||
|
||||
# overwritten to avoid emitting empty <ul></ul>
|
||||
def visit_bullet_list(self, node):
|
||||
if len(node) == 1 and node[0].tagname == 'toctree':
|
||||
@ -268,6 +274,7 @@ class HTMLTranslator(BaseTranslator):
|
||||
def visit_title(self, node):
|
||||
BaseTranslator.visit_title(self, node)
|
||||
self.add_secnumber(node)
|
||||
self.add_fignumber(node)
|
||||
|
||||
# overwritten
|
||||
def visit_literal_block(self, node):
|
||||
|
@ -15,6 +15,16 @@ should be 2.1
|
||||
|
||||
should be Fig.2.1
|
||||
|
||||
.. csv-table:: should be Table 2.1
|
||||
:header-rows: 0
|
||||
|
||||
hello,world
|
||||
|
||||
.. code-block:: python
|
||||
:caption: should be List 2.1
|
||||
|
||||
print('hello world')
|
||||
|
||||
.. toctree::
|
||||
|
||||
baz
|
||||
@ -23,6 +33,16 @@ should be 2.1
|
||||
|
||||
should be Fig.2.3
|
||||
|
||||
.. csv-table:: should be Table 2.3
|
||||
:header-rows: 0
|
||||
|
||||
hello,world
|
||||
|
||||
.. code-block:: python
|
||||
:caption: should be List 2.3
|
||||
|
||||
print('hello world')
|
||||
|
||||
Bar B
|
||||
=====
|
||||
|
||||
@ -36,3 +56,13 @@ should be 2.2.1
|
||||
.. figure:: rimg.png
|
||||
|
||||
should be Fig.2.4
|
||||
|
||||
.. csv-table:: should be Table 2.4
|
||||
:header-rows: 0
|
||||
|
||||
hello,world
|
||||
|
||||
.. code-block:: python
|
||||
:caption: should be List 2.4
|
||||
|
||||
print('hello world')
|
||||
|
@ -6,3 +6,13 @@ should be 2.1.1
|
||||
.. figure:: rimg.png
|
||||
|
||||
should be Fig.2.2
|
||||
|
||||
.. csv-table:: should be Table 2.2
|
||||
:header-rows: 0
|
||||
|
||||
hello,world
|
||||
|
||||
.. code-block:: python
|
||||
:caption: should be List 2.2
|
||||
|
||||
print('hello world')
|
||||
|
@ -8,6 +8,16 @@ should be 1
|
||||
|
||||
should be Fig.1.1
|
||||
|
||||
.. csv-table:: should be Table 1.1
|
||||
:header-rows: 0
|
||||
|
||||
hello,world
|
||||
|
||||
.. code-block:: python
|
||||
:caption: should be List 1.1
|
||||
|
||||
print('hello world')
|
||||
|
||||
Foo A
|
||||
=====
|
||||
|
||||
@ -21,6 +31,26 @@ should be 1.1
|
||||
|
||||
should be Fig.1.3
|
||||
|
||||
.. csv-table:: should be Table 1.2
|
||||
:header-rows: 0
|
||||
|
||||
hello,world
|
||||
|
||||
.. csv-table:: should be Table 1.3
|
||||
:header-rows: 0
|
||||
|
||||
hello,world
|
||||
|
||||
.. code-block:: python
|
||||
:caption: should be List 1.2
|
||||
|
||||
print('hello world')
|
||||
|
||||
.. code-block:: python
|
||||
:caption: should be List 1.3
|
||||
|
||||
print('hello world')
|
||||
|
||||
Foo A1
|
||||
------
|
||||
|
||||
@ -39,3 +69,13 @@ should be 1.2.1
|
||||
.. figure:: rimg.png
|
||||
|
||||
should be Fig.1.4
|
||||
|
||||
.. csv-table:: should be Table 1.4
|
||||
:header-rows: 0
|
||||
|
||||
hello,world
|
||||
|
||||
.. code-block:: python
|
||||
:caption: should be List 1.4
|
||||
|
||||
print('hello world')
|
||||
|
@ -14,3 +14,23 @@ test-tocdepth
|
||||
.. figure:: rimg.png
|
||||
|
||||
should be Fig.2
|
||||
|
||||
.. csv-table:: should be Table 1
|
||||
:header-rows: 0
|
||||
|
||||
hello,world
|
||||
|
||||
.. csv-table:: should be Table 2
|
||||
:header-rows: 0
|
||||
|
||||
hello,world
|
||||
|
||||
.. code-block:: python
|
||||
:caption: should be List 1
|
||||
|
||||
print('hello world')
|
||||
|
||||
.. code-block:: python
|
||||
:caption: should be List 2
|
||||
|
||||
print('hello world')
|
||||
|
@ -384,6 +384,12 @@ def test_tocdepth(app, status, warning):
|
||||
'^should be Fig.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^should be Fig.2$', True),
|
||||
(".//table/caption", '^should be Table 1$', True),
|
||||
(".//table/caption", '^should be Table 2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 2$', True),
|
||||
],
|
||||
'foo.html': [
|
||||
(".//h1", '1. Foo', True),
|
||||
@ -399,6 +405,18 @@ def test_tocdepth(app, status, warning):
|
||||
'^should be Fig.1.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^should be Fig.1.4$', True),
|
||||
(".//table/caption", '^should be Table 1.1$', True),
|
||||
(".//table/caption", '^should be Table 1.2$', True),
|
||||
(".//table/caption", '^should be Table 1.3$', True),
|
||||
(".//table/caption", '^should be Table 1.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 1.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 1.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 1.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 1.4$', True),
|
||||
],
|
||||
'bar.html': [
|
||||
(".//h1", '2. Bar', True),
|
||||
@ -411,11 +429,23 @@ def test_tocdepth(app, status, warning):
|
||||
'^should be Fig.2.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^should be Fig.2.4$', True),
|
||||
(".//table/caption", '^should be Table 2.1$', True),
|
||||
(".//table/caption", '^should be Table 2.3$', True),
|
||||
(".//table/caption", '^should be Table 2.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 2.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 2.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 2.4$', True),
|
||||
],
|
||||
'baz.html': [
|
||||
(".//h1", '2.1.1. Baz A', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^should be Fig.2.2$', True),
|
||||
(".//table/caption", '^should be Table 2.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^should be List 2.2$', True),
|
||||
],
|
||||
}
|
||||
|
||||
@ -447,6 +477,12 @@ def test_unnumbered_toctree_with_numfig(app, status, warning):
|
||||
'^Fig.9 should be Fig.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.10 should be Fig.2$', True),
|
||||
(".//table/caption", '^Table 9 should be Table 1$', True),
|
||||
(".//table/caption", '^Table 10 should be Table 2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 9 should be List 1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 10 should be List 2$', True),
|
||||
],
|
||||
'foo.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
@ -457,6 +493,18 @@ def test_unnumbered_toctree_with_numfig(app, status, warning):
|
||||
'^Fig.3 should be Fig.1.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.4 should be Fig.1.4$', True),
|
||||
(".//table/caption", '^Table 1 should be Table 1.1$', True),
|
||||
(".//table/caption", '^Table 2 should be Table 1.2$', True),
|
||||
(".//table/caption", '^Table 3 should be Table 1.3$', True),
|
||||
(".//table/caption", '^Table 4 should be Table 1.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1 should be List 1.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2 should be List 1.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 3 should be List 1.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 4 should be List 1.4$', True),
|
||||
],
|
||||
'bar.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
@ -465,10 +513,22 @@ def test_unnumbered_toctree_with_numfig(app, status, warning):
|
||||
'^Fig.7 should be Fig.2.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.8 should be Fig.2.4$', True),
|
||||
(".//table/caption", '^Table 5 should be Table 2.1$', True),
|
||||
(".//table/caption", '^Table 7 should be Table 2.3$', True),
|
||||
(".//table/caption", '^Table 8 should be Table 2.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 5 should be List 2.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 7 should be List 2.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 8 should be List 2.4$', True),
|
||||
],
|
||||
'baz.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.6 should be Fig.2.2$', True),
|
||||
(".//table/caption", '^Table 6 should be Table 2.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 6 should be List 2.2$', True),
|
||||
],
|
||||
}
|
||||
|
||||
@ -496,6 +556,12 @@ def test_numbered_toctree_with_numfig(app, status, warning):
|
||||
'^Fig.1 should be Fig.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2 should be Fig.2$', True),
|
||||
(".//table/caption", '^Table 1 should be Table 1$', True),
|
||||
(".//table/caption", '^Table 2 should be Table 2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1 should be List 1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2 should be List 2$', True),
|
||||
],
|
||||
'foo.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
@ -506,6 +572,18 @@ def test_numbered_toctree_with_numfig(app, status, warning):
|
||||
'^Fig.1.3 should be Fig.1.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.1.4 should be Fig.1.4$', True),
|
||||
(".//table/caption", '^Table 1.1 should be Table 1.1$', True),
|
||||
(".//table/caption", '^Table 1.2 should be Table 1.2$', True),
|
||||
(".//table/caption", '^Table 1.3 should be Table 1.3$', True),
|
||||
(".//table/caption", '^Table 1.4 should be Table 1.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1.1 should be List 1.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1.2 should be List 1.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1.3 should be List 1.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1.4 should be List 1.4$', True),
|
||||
],
|
||||
'bar.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
@ -514,10 +592,22 @@ def test_numbered_toctree_with_numfig(app, status, warning):
|
||||
'^Fig.2.3 should be Fig.2.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2.4 should be Fig.2.4$', True),
|
||||
(".//table/caption", '^Table 2.1 should be Table 2.1$', True),
|
||||
(".//table/caption", '^Table 2.3 should be Table 2.3$', True),
|
||||
(".//table/caption", '^Table 2.4 should be Table 2.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2.1 should be List 2.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2.3 should be List 2.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2.4 should be List 2.4$', True),
|
||||
],
|
||||
'baz.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2.2 should be Fig.2.2$', True),
|
||||
(".//table/caption", '^Table 2.2 should be Table 2.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2.2 should be List 2.2$', True),
|
||||
],
|
||||
}
|
||||
|
||||
@ -535,7 +625,7 @@ def test_numbered_toctree_with_numfig(app, status, warning):
|
||||
|
||||
|
||||
@gen_with_app(buildername='html', testroot='tocdepth',
|
||||
confoverrides={'numfig': True, 'numfig_prefix': {'figure': 'Figure:'}})
|
||||
confoverrides={'numfig': True, 'numfig_prefix': {'figure': 'Figure:', 'table': 'Tab_', 'code-block': 'Code-'}})
|
||||
def test_numbered_toctree_with_numfig_prefix(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
@ -545,6 +635,12 @@ def test_numbered_toctree_with_numfig_prefix(app, status, warning):
|
||||
'^Figure:1 should be Fig.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Figure:2 should be Fig.2$', True),
|
||||
(".//table/caption", '^Tab_1 should be Table 1$', True),
|
||||
(".//table/caption", '^Tab_2 should be Table 2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-1 should be List 1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-2 should be List 2$', True),
|
||||
],
|
||||
'foo.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
@ -555,6 +651,18 @@ def test_numbered_toctree_with_numfig_prefix(app, status, warning):
|
||||
'^Figure:1.3 should be Fig.1.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Figure:1.4 should be Fig.1.4$', True),
|
||||
(".//table/caption", '^Tab_1.1 should be Table 1.1$', True),
|
||||
(".//table/caption", '^Tab_1.2 should be Table 1.2$', True),
|
||||
(".//table/caption", '^Tab_1.3 should be Table 1.3$', True),
|
||||
(".//table/caption", '^Tab_1.4 should be Table 1.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-1.1 should be List 1.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-1.2 should be List 1.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-1.3 should be List 1.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-1.4 should be List 1.4$', True),
|
||||
],
|
||||
'bar.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
@ -563,10 +671,22 @@ def test_numbered_toctree_with_numfig_prefix(app, status, warning):
|
||||
'^Figure:2.3 should be Fig.2.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Figure:2.4 should be Fig.2.4$', True),
|
||||
(".//table/caption", '^Tab_2.1 should be Table 2.1$', True),
|
||||
(".//table/caption", '^Tab_2.3 should be Table 2.3$', True),
|
||||
(".//table/caption", '^Tab_2.4 should be Table 2.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-2.1 should be List 2.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-2.3 should be List 2.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-2.4 should be List 2.4$', True),
|
||||
],
|
||||
'baz.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Figure:2.2 should be Fig.2.2$', True),
|
||||
(".//table/caption", '^Tab_2.2 should be Table 2.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^Code-2.2 should be List 2.2$', True),
|
||||
],
|
||||
}
|
||||
|
||||
@ -594,6 +714,12 @@ def test_numbered_toctree_with_numfig_secnum_depth(app, status, warning):
|
||||
'^Fig.1 should be Fig.1$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2 should be Fig.2$', True),
|
||||
(".//table/caption", '^Table 1 should be Table 1$', True),
|
||||
(".//table/caption", '^Table 2 should be Table 2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1 should be List 1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2 should be List 2$', True),
|
||||
],
|
||||
'foo.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
@ -604,6 +730,18 @@ def test_numbered_toctree_with_numfig_secnum_depth(app, status, warning):
|
||||
'^Fig.1.1.2 should be Fig.1.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.1.2.1 should be Fig.1.4$', True),
|
||||
(".//table/caption", '^Table 1.1 should be Table 1.1$', True),
|
||||
(".//table/caption", '^Table 1.1.1 should be Table 1.2$', True),
|
||||
(".//table/caption", '^Table 1.1.2 should be Table 1.3$', True),
|
||||
(".//table/caption", '^Table 1.2.1 should be Table 1.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1.1 should be List 1.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1.1.1 should be List 1.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1.1.2 should be List 1.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 1.2.1 should be List 1.4$', True),
|
||||
],
|
||||
'bar.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
@ -612,10 +750,22 @@ def test_numbered_toctree_with_numfig_secnum_depth(app, status, warning):
|
||||
'^Fig.2.1.3 should be Fig.2.3$', True),
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2.2.1 should be Fig.2.4$', True),
|
||||
(".//table/caption", '^Table 2.1.1 should be Table 2.1$', True),
|
||||
(".//table/caption", '^Table 2.1.3 should be Table 2.3$', True),
|
||||
(".//table/caption", '^Table 2.2.1 should be Table 2.4$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2.1.1 should be List 2.1$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2.1.3 should be List 2.3$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2.2.1 should be List 2.4$', True),
|
||||
],
|
||||
'baz.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']",
|
||||
'^Fig.2.1.2 should be Fig.2.2$', True),
|
||||
(".//table/caption", '^Table 2.1.2 should be Table 2.2$', True),
|
||||
(".//div[@class='code-block-caption']",
|
||||
'^List 2.1.2 should be List 2.2$', True),
|
||||
],
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user