Skip to content

Commit

Permalink
Check if the hierarchy files exist before generating includes. (#147)
Browse files Browse the repository at this point in the history
Previously exhale was trying to `.. include::` files that were not necessarily generated.
  • Loading branch information
clalancette authored Feb 9, 2022
1 parent 329c443 commit 36665ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Changelog
v0.3.0
----------------------------------------------------------------------------------------

- Do not write source files for empty hierarchies (:pr:`134`).
- Do not write source files for empty hierarchies (:pr:`134`, :pr:`147`).
- Support specialized template functions (:pr:`117`).
- Prevent sphinx from processing files that are incorporated via a ``.. include::``
directive by renaming them to ``.rst.include`` suffix (:pr:`136`).
Expand Down
6 changes: 3 additions & 3 deletions exhale/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -3536,15 +3536,15 @@ def generateAPIRootBody(self):
))
break
# Include the page, class, and file hierarchies
if any(node.kind == "page" for node in self.all_nodes):
if os.path.exists(self.page_hierarchy_file):
generated_index.write(".. include:: {0}\n\n".format(
os.path.basename(self.page_hierarchy_file)
))
if any(node.kind in utils.CLASS_LIKE_KINDS for node in self.all_nodes):
if os.path.exists(self.class_hierarchy_file):
generated_index.write(".. include:: {0}\n\n".format(
os.path.basename(self.class_hierarchy_file)
))
if any(node.kind in {"dir", "file"} for node in self.all_nodes):
if os.path.exists(self.file_hierarchy_file):
generated_index.write(".. include:: {0}\n\n".format(
os.path.basename(self.file_hierarchy_file)
))
Expand Down

0 comments on commit 36665ce

Please sign in to comment.