|
4 | 4 |
|
5 | 5 | This script builds the documentation for all configured languages |
6 | 6 | (English, Spanish, Portuguese, and Brazilian Portuguese). |
| 7 | +
|
| 8 | +Before building, runs scripts/verify_docs_nav.py (every .md is listed in nav). |
| 9 | +After a successful build, runs scripts/verify_docs_rendered.py (every .md has HTML output). |
7 | 10 | """ |
8 | 11 |
|
9 | 12 | import subprocess |
10 | 13 | import sys |
11 | 14 | from pathlib import Path |
12 | 15 |
|
13 | 16 | ROOT = Path(__file__).parent |
| 17 | +VERIFY_NAV = ROOT / "scripts" / "verify_docs_nav.py" |
| 18 | +VERIFY_RENDERED = ROOT / "scripts" / "verify_docs_rendered.py" |
14 | 19 | CONFIG_FILES = [ |
15 | 20 | "zensical.toml", # English |
16 | 21 | "zensical.es.toml", # Spanish |
@@ -49,7 +54,20 @@ def run_command(cmd, description): |
49 | 54 | def main(): |
50 | 55 | print("🌍 Building omegaUp Documentation - All Languages") |
51 | 56 | print(f"📂 Working directory: {ROOT}") |
52 | | - |
| 57 | + |
| 58 | + if not VERIFY_NAV.is_file(): |
| 59 | + print(f"❌ Missing {VERIFY_NAV.name}; cannot verify navigation coverage.") |
| 60 | + return 1 |
| 61 | + if not run_command( |
| 62 | + [PYTHON, str(VERIFY_NAV)], |
| 63 | + "Verifying nav covers every markdown page (all locales)", |
| 64 | + ): |
| 65 | + print( |
| 66 | + "\nFix orphan pages in zensical*.toml, then rebuild. " |
| 67 | + "See scripts/verify_docs_nav.py for rules." |
| 68 | + ) |
| 69 | + return 1 |
| 70 | + |
53 | 71 | # Clean the site directory first |
54 | 72 | print("\n🧹 Cleaning site directory...") |
55 | 73 | site_dir = ROOT / "site" |
@@ -105,25 +123,38 @@ def main(): |
105 | 123 | index_file = ROOT / "site" / "index.html" |
106 | 124 | index_file.write_text(redirect_html, encoding="utf-8") |
107 | 125 | print(" Created site/index.html redirect") |
108 | | - |
| 126 | + |
109 | 127 | # Summary |
110 | 128 | print("\n" + "="*60) |
111 | 129 | if failures: |
112 | | - print(f"⚠️ Build completed with errors") |
| 130 | + print("⚠️ Build completed with errors") |
113 | 131 | print(f" Failed languages: {', '.join(failures)}") |
114 | 132 | return 1 |
115 | | - else: |
116 | | - print("✅ All language versions built successfully!") |
117 | | - print("\n📚 Available languages:") |
118 | | - print(" • English: site/en/") |
119 | | - print(" • Español: site/es/") |
120 | | - print(" • Português: site/pt/") |
121 | | - print(" • Português (Brasil): site/pt-BR/") |
122 | | - print("\n🚀 To serve locally, run:") |
123 | | - print(" python3 serve_multilang.py") |
124 | | - print(" or") |
125 | | - print(" cd site && python3 -m http.server 8000") |
126 | | - return 0 |
| 133 | + |
| 134 | + if not VERIFY_RENDERED.is_file(): |
| 135 | + print(f"❌ Missing {VERIFY_RENDERED.name}; cannot verify rendered HTML.") |
| 136 | + return 1 |
| 137 | + if not run_command( |
| 138 | + [PYTHON, str(VERIFY_RENDERED)], |
| 139 | + "Verifying every markdown page produced HTML (all locales)", |
| 140 | + ): |
| 141 | + print( |
| 142 | + "\nSome source pages are missing from site/. " |
| 143 | + "See scripts/verify_docs_rendered.py." |
| 144 | + ) |
| 145 | + return 1 |
| 146 | + |
| 147 | + print("✅ All language versions built successfully!") |
| 148 | + print("\n📚 Available languages:") |
| 149 | + print(" • English: site/en/") |
| 150 | + print(" • Español: site/es/") |
| 151 | + print(" • Português: site/pt/") |
| 152 | + print(" • Português (Brasil): site/pt-BR/") |
| 153 | + print("\n🚀 To serve locally, run:") |
| 154 | + print(" python3 serve_multilang.py") |
| 155 | + print(" or") |
| 156 | + print(" cd site && python3 -m http.server 8000") |
| 157 | + return 0 |
127 | 158 |
|
128 | 159 | if __name__ == "__main__": |
129 | 160 | try: |
|
0 commit comments