Assign fignum to tables and code-blocks

This commit is contained in:
tk0miya
2014-09-27 00:47:44 +09:00
parent cffec13355
commit 7cd470f59a
9 changed files with 300 additions and 13 deletions

View File

@@ -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),
],
}