Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/debug1 #21

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions sphinx_ape/sphinx_ext/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -85,6 +90,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:
Expand All @@ -101,10 +110,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]:
Expand Down