Skip empty doc files and prune dead type-index entries

- render_header() returns "" when a header has no documented content
  (no /** */ comments on any class, property, function, enum, or delegate)
- generate.py skips writing those files and tracks which were written
- type-index.txt is filtered to only include types from written files,
  preventing dead entries that would cause get_class_overview to fail
- Summary line now reports how many files were skipped

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 10:38:29 -05:00
parent 0bb96dca54
commit 3d075cea20
4 changed files with 25 additions and 9 deletions

View File

@@ -135,6 +135,8 @@ def main():
# --- Pass 2: render all ---
success = 0
skipped = 0
written_mds: set[str] = set()
for h, base, parsed in parsed_list:
print(f"Rendering {h} ...")
current_md = _md_rel(h, base)
@@ -143,13 +145,20 @@ def main():
try:
md = render_header(parsed, type_index=type_index, current_md=current_md)
if not md:
skipped += 1
continue
out_path.write_text(md, encoding='utf-8')
written_mds.add(current_md)
success += 1
except Exception as exc:
print(f" ERROR rendering {h}: {exc}", file=sys.stderr)
# Remove type-index entries whose files were not written (no documented content)
type_index = {name: path for name, path in type_index.items() if path in written_mds}
write_type_index(type_index, output_dir)
print(f"\nGenerated {success}/{len(parsed_list)} files + type-index.txt in {output_dir}/")
print(f"\nGenerated {success}/{len(parsed_list)} files "
f"({skipped} skipped — no documented content) + type-index.txt in {output_dir}/")
if __name__ == '__main__':