Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ pristine: clean
.PHONY: clean
clean:
rm -rf $(BUILDDIR)/*
# We need to use git clean instead of rm -rf because
# source/api/index.rst is actually tracked by git.
git clean -f -d -X $(SOURCEDIR)/api/
rm -rf ../doxygen/*

# Generate output commands
.PHONY: dirhtml
Expand Down
42 changes: 38 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import re
import sys
import warnings
import xml.etree.ElementTree as ET
from datetime import date

from sphinx_scylladb_theme.utils import multiversion_regex_builder
Expand Down Expand Up @@ -112,7 +113,7 @@
def _generate_structs(outdir, structs, project):
"""Write structs docs in the designated outdir folder"""
for obj in structs:
with open(outdir + "/struct." + obj + ".rst", "w") as t_file:
with open(outdir / f"struct.{obj}.rst", "w") as t_file:
t_file.write(
obj
+ "\n"
Expand All @@ -125,25 +126,58 @@ def _generate_structs(outdir, structs, project):
)


def _generate_groups(outdir, groups, project):
"""Write structs docs in the designated outdir folder"""
for obj in groups:
with open(outdir / f"group.{obj}.rst", "w") as t_file:
t_file.write(
obj
+ "\n"
+ "=" * len(obj)
+ "\n\n"
+ ".. doxygengroup:: "
+ obj
+ "\n :project: "
+ breathe_default_project
+ "\n :content-only:"
)
Comment on lines +129 to +143
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ How did you know how to do that?

  • similar to something else in the code?
  • documentation?
  • AI?

Please explain this in a comment.

Copy link
Copy Markdown
Contributor Author

@Lorak-mmk Lorak-mmk Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI. I ofc read the code to see if it looks reasonable + tested that it works.
I don't think its useful to describe in the comments "how I found some informations". Comments should explain how something works, and sometimes why it works that way.



def _generate_doxygen_rst(xmldir, outdir):
"""Autogenerate doxygen docs in the designated outdir folder"""
structs = []
files = os.listdir(os.path.join(os.path.dirname(__file__), xmldir))
groups = []
group_structs = set()
xml_path = os.path.join(os.path.dirname(__file__), xmldir)
files = os.listdir(xml_path)
for file_name in files:
if file_name.startswith("group__") and file_name.endswith(".xml"):
tree = ET.parse(os.path.join(xml_path, file_name))
root = tree.getroot()
compoundname = root.find(".//compoundname")
if compoundname is not None and compoundname.text:
group_name = compoundname.text
groups.append(group_name)
for inner in root.iter("innerclass"):
group_structs.add(inner.text)
for file_name in files:
if "struct" in file_name and "__" not in file_name:
structs.append(
name = (
file_name.replace("struct_", "")
.replace("_", " ")
.replace(".xml", "")
.title()
.replace(" ", "")
)
if name not in group_structs:
structs.append(name)
_generate_structs(outdir, structs, breathe_default_project)
_generate_groups(outdir, groups, breathe_default_project)


def generate_doxygen(app):
DOXYGEN_XML_DIR = breathe_projects[breathe_default_project]
_generate_doxygen_rst(DOXYGEN_XML_DIR, app.builder.srcdir + "/api")
_generate_doxygen_rst(DOXYGEN_XML_DIR, app.builder.srcdir / "api")


# -- Options for sitemap extension
Expand Down
Loading