mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix toctree generation
This commit is contained in:
parent
71d1b37f8a
commit
aae8ce8efa
@ -252,7 +252,9 @@ class Autosummary(SphinxDirective):
|
||||
tree_prefix = self.options['toctree'].strip()
|
||||
docnames = []
|
||||
excluded = Matcher(self.config.exclude_patterns)
|
||||
filename_map = self.config.autosummary_filename_map
|
||||
for name, sig, summary, real_name in items:
|
||||
real_name = filename_map.get(real_name, real_name)
|
||||
docname = posixpath.join(tree_prefix, real_name)
|
||||
docname = posixpath.normpath(posixpath.join(dirname, docname))
|
||||
if docname not in self.env.found_docs:
|
||||
@ -785,11 +787,11 @@ def setup(app: Sphinx) -> Dict[str, Any]:
|
||||
app.add_role('autolink', AutoLink())
|
||||
app.connect('builder-inited', process_generate_options)
|
||||
app.add_config_value('autosummary_context', {}, True)
|
||||
app.add_config_value('autosummary_filename_map', {}, 'html')
|
||||
app.add_config_value('autosummary_generate', [], True, [bool])
|
||||
app.add_config_value('autosummary_generate_overwrite', True, False)
|
||||
app.add_config_value('autosummary_mock_imports',
|
||||
lambda config: config.autodoc_mock_imports, 'env')
|
||||
app.add_config_value('autosummary_imported_members', [], False, [bool])
|
||||
app.add_config_value('autosummary_filename_map', {}, 'html')
|
||||
|
||||
return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
|
||||
|
@ -396,9 +396,6 @@ def generate_autosummary_docs(sources: List[str], output_dir: str = None,
|
||||
|
||||
if app:
|
||||
filename_map = app.config.autosummary_filename_map
|
||||
if not isinstance(filename_map, Mapping):
|
||||
raise TypeError('autosummary_filename_map should be a mapping from '
|
||||
'strings to strings')
|
||||
else:
|
||||
filename_map = {}
|
||||
|
||||
|
@ -9,6 +9,5 @@
|
||||
|
||||
autosummary_dummy_module
|
||||
autosummary_dummy_module.Foo
|
||||
autosummary_dummy_module.Foo.Bar
|
||||
autosummary_dummy_module.Foo.bar
|
||||
autosummary_dummy_module.bar
|
||||
autosummary_dummy_module.qux
|
||||
|
@ -396,6 +396,9 @@ def test_autosummary_filename_map(app, status, warning):
|
||||
assert not (app.srcdir / 'generated' / 'autosummary_dummy_module.bar.rst').exists()
|
||||
assert (app.srcdir / 'generated' / 'autosummary_dummy_module.Foo.rst').exists()
|
||||
|
||||
html_warnings = app._warning.getvalue()
|
||||
assert html_warnings == ''
|
||||
|
||||
|
||||
@pytest.mark.sphinx('latex', **default_kw)
|
||||
def test_autosummary_latex_table_colspec(app, status, warning):
|
||||
|
Loading…
Reference in New Issue
Block a user