From fe7ddca1b5f2cd16e8c99d448dc6eeb392460823 Mon Sep 17 00:00:00 2001 From: Juliya Smith Date: Tue, 15 Oct 2024 11:21:21 -0600 Subject: [PATCH 1/2] refactor: put in right spot --- sphinx_ape/sphinx_ext/directives.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sphinx_ape/sphinx_ext/directives.py b/sphinx_ape/sphinx_ext/directives.py index b788100..6c86189 100644 --- a/sphinx_ape/sphinx_ext/directives.py +++ b/sphinx_ape/sphinx_ext/directives.py @@ -85,6 +85,10 @@ def run(self): # Plugin or regular package. sections["Python Reference"] = methoddocs + # Ensure TOC is not empty (no docs?). + if not sections or not any(len(x) for x in sections.values()): + raise BuildError("Empty TOC.") + toc_trees = [] for caption, entries in sections.items(): if len(entries) < 1: @@ -101,10 +105,6 @@ def run(self): if toc_tree_rst: restructured_text = f"{restructured_text}\n\n{toc_tree_rst}" - # Ensure TOC is not empty (no docs?). - if not sections or not any(len(x) for x in sections.values()): - raise BuildError("Empty TOC.") - return self.parse_text_to_nodes(restructured_text) def _get_userguides(self) -> list[str]: From afa31048a659092d33ffe72b373ef3a99ff3feef Mon Sep 17 00:00:00 2001 From: Juliya Smith Date: Tue, 15 Oct 2024 11:23:47 -0600 Subject: [PATCH 2/2] chore: debug stmt --- sphinx_ape/sphinx_ext/directives.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sphinx_ape/sphinx_ext/directives.py b/sphinx_ape/sphinx_ext/directives.py index 6c86189..77327ca 100644 --- a/sphinx_ape/sphinx_ext/directives.py +++ b/sphinx_ape/sphinx_ext/directives.py @@ -67,6 +67,11 @@ def builder(self) -> DocumentationBuilder: def run(self): userguides = self._get_userguides() + + # TODO: DELETE THIS! FORCED TO DEBUG LIKE THIS. + if not userguides: + raise ValueError("DEBUG") + cli_docs = self._get_cli_references() methoddocs = self._get_methoddocs()