Add Sphinx.add_enumerable_node() to add enumerable nodes for numfig feature

This commit is contained in:
Takeshi KOMIYA
2016-02-13 21:22:21 +09:00
parent 279ac7c23f
commit a391b1a1db
8 changed files with 135 additions and 0 deletions

View File

@@ -941,6 +941,34 @@ def test_numfig_with_secnum_depth(app, status, warning):
yield check_xpath, etree, fname, xpath, check, be_found
@gen_with_app(buildername='html', testroot='add_enumerable_node')
def test_enumerable_node(app, status, warning):
app.builder.build_all()
expects = {
'index.html': [
(".//div[@class='figure']/p[@class='caption']/span[@class='caption-number']",
"Fig. 1", True),
(".//div[@class='figure']/p[@class='caption']/span[@class='caption-number']",
"Fig. 2", True),
(".//div[@class='figure']/p[@class='caption']/span[@class='caption-number']",
"Fig. 3", True),
(".//li/a/span", 'Fig. 1', True),
(".//li/a/span", 'Fig. 2', True),
(".//li/a/span", 'Fig. 3', True),
],
}
for fname, paths in iteritems(expects):
parser = NslessParser()
parser.entity.update(html_entities.entitydefs)
with (app.outdir / fname).open('rb') as fp:
etree = ET.parse(fp, parser)
for xpath, check, be_found in paths:
yield check_xpath, etree, fname, xpath, check, be_found
@with_app(buildername='html')
def test_jsmath(app, status, warning):
app.builder.build_all()