|
1 | 1 | #!/usr/bin/env python3 |
2 | | -"""Generate API landing pages for pre_process, simulation, and post_process. |
| 2 | +"""Generate API landing pages for MFC documentation. |
3 | 3 |
|
4 | 4 | Usage: python3 gen_api_landing.py [source_dir] |
5 | 5 | source_dir defaults to current directory. |
6 | 6 |
|
7 | 7 | Scans src/{target}/*.fpp,*.f90 and src/common/*.fpp,*.f90 to produce module |
8 | | -tables in docs/{target}/readme.md. Intro text is defined below per target. |
| 8 | +tables in docs/{target}/readme.md. Also generates a unified API landing page |
| 9 | +at docs/api/readme.md that links to all three sub-project APIs. |
9 | 10 | """ |
10 | 11 |
|
11 | 12 | from __future__ import annotations |
@@ -149,3 +150,31 @@ def get_modules(directory: Path) -> list[tuple[str, str]]: |
149 | 150 | out.parent.mkdir(parents=True, exist_ok=True) |
150 | 151 | out.write_text("\n".join(lines), encoding="utf-8") |
151 | 152 | print(f"Generated {out}") |
| 153 | + |
| 154 | +# --- Unified API landing page --- |
| 155 | +api_lines = [ |
| 156 | + "@mainpage API Documentation", |
| 157 | + "", |
| 158 | + "MFC's source code is organized into three components that form a complete " |
| 159 | + "simulation pipeline. Each component has full module-level API documentation.", |
| 160 | + "", |
| 161 | +] |
| 162 | + |
| 163 | +for target, info in TARGETS.items(): |
| 164 | + label = info["title"].replace("MFC ", "") |
| 165 | + api_lines.append(f"### [{label}](../{target}/index.html)") |
| 166 | + api_lines.append("") |
| 167 | + api_lines.append(info["intro"]) |
| 168 | + api_lines.append("") |
| 169 | + |
| 170 | +api_lines.append( |
| 171 | + "All three components share a set of **common modules** for MPI communication, " |
| 172 | + "variable conversion, derived types, and utility functions. " |
| 173 | + "These are documented within each component's API reference." |
| 174 | +) |
| 175 | +api_lines.append("") |
| 176 | + |
| 177 | +api_out = src_dir / "docs" / "api" / "readme.md" |
| 178 | +api_out.parent.mkdir(parents=True, exist_ok=True) |
| 179 | +api_out.write_text("\n".join(api_lines), encoding="utf-8") |
| 180 | +print(f"Generated {api_out}") |
0 commit comments