Skip to content

Ensure all confval directives are preceded by a section heading #535

Description

@ineswillenbrock

We need to check and ensure that all confval directives across the documentation have a dedicated section heading directly preceding them.

Task

  1. Run the Python script below in the root of the repository to list all files and line numbers where a confval block lacks a preceding headline.
  2. Add appropriate section headlines above the affected confval blocks using consistent heading levels (e.g., - or ~ depending on the surrounding hierarchy).

Helper Script

Save and run this script from the repository root to find all affected locations:

import os
import re

confval_missing_heading = []
total_confval = 0

for root, dirs, files in os.walk("."):
    dirs[:] = [d for d in dirs if not d.startswith('.')]
    for file in sorted(files):
        if file.endswith(".rst"):
            filepath = os.path.join(root, file)
            try:
                with open(filepath, "r", encoding="utf-8") as f:
                    lines = f.readlines()
            except Exception:
                continue

            for idx, line in enumerate(lines):
                if re.match(r"^\s*\.\.\s+confval::", line):
                    total_confval += 1
                    has_heading = False
                    start_look = max(0, idx - 15)
                    for check_idx in range(idx - 1, start_look - 1, -1):
                        chk_line = lines[check_idx].strip()
                        # Check for reST heading underline adornments
                        if chk_line and len(set(chk_line)) == 1 and chk_line[0] in "=-~`'^\"*+#_":
                            has_heading = True
                            break
                        if re.match(r"^\s*\.\.\s+confval::", lines[check_idx]):
                            break

                    if not has_heading:
                        confval_missing_heading.append((filepath, idx + 1, line.strip()))

print(f"Total confval blocks found: {total_confval}")
print(f"Total missing preceding heading: {len(confval_missing_heading)}\n")
print("Affected locations:")
for path, line_no, content in confval_missing_heading:
    print(f"  {path}:{line_no} -> {content}")
```***

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions