From 0cee7306931812d4e1d47ee1c5822cde9205ac3e Mon Sep 17 00:00:00 2001 From: Ashley Whetter Date: Sun, 21 Apr 2019 12:16:18 -0700 Subject: [PATCH] Do not add a toctree entry when not generating docs --- autoapi/extension.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autoapi/extension.py b/autoapi/extension.py index 8689402..e638aa1 100644 --- a/autoapi/extension.py +++ b/autoapi/extension.py @@ -128,7 +128,12 @@ def doctree_read(app, doctree): insert = True nodes = doctree.traverse(toctree) toc_entry = "%s/index" % app.config.autoapi_root - if not nodes: + add_entry = ( + nodes + and app.config.autoapi_generate_api_docs + and app.config.autoapi_add_toctree_entry + ) + if not add_entry: return # Capture all existing toctree entries for node in nodes: