Skip to content

Commit

Permalink
Make sphinx show a summary of the search result (#15605)
Browse files Browse the repository at this point in the history
  • Loading branch information
themylogin authored Feb 6, 2025
1 parent ba6f286 commit 1f42eef
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/middlewared_docs/generate_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,18 @@ def main(output_dir):
shutil.rmtree(f"{output_dir}/rst")
shutil.rmtree(f"{output_dir}/html")

for root, dirs, files in os.walk(output_dir):
for filename in files:
if filename.endswith(".html"):
with open(f"{root}/{filename}") as f:
contents = f.read()

# Make sphinx show a summary of the search result (sphinxbootstrap4theme breaks this)
contents = contents.replace('<div class="bodywrapper">', '<div class="bodywrapper" role="main">')

with open(f"{root}/{filename}", "w") as f:
f.write(contents)


if __name__ == "__main__":
main(sys.argv[1])

0 comments on commit 1f42eef

Please sign in to comment.