MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / step_update_nav

Function step_update_nav

Scripts/generate_docs.py:166–185  ·  view source on GitHub ↗
(nav_yaml: str)

Source from the content-addressed store, hash-verified

164_NAV_API_STUB = ' - API Reference:\n - api/index.md'
165
166def step_update_nav(nav_yaml: str):
167 print("\n─── Step 3: Updating mkdocs.yml nav ───")
168
169 with open(MKDOCS_YML, 'r', encoding='utf-8') as f:
170 content = f.read()
171
172 # Find the sentinel comment and replace everything after it (within nav)
173 if _NAV_SENTINEL in content:
174 before = content[:content.index(_NAV_SENTINEL)]
175 new_section = f"{_NAV_SENTINEL}\n{nav_yaml}"
176 new_content = before + new_section
177 else:
178 # Sentinel not found — append nav block
179 print(" ⚠ Sentinel not found in mkdocs.yml — appending nav block")
180 new_content = content.rstrip() + '\n' + _NAV_SENTINEL + '\n' + nav_yaml + '\n'
181
182 with open(MKDOCS_YML, 'w', encoding='utf-8') as f:
183 f.write(new_content)
184
185 print(f" ✓ Updated mkdocs.yml nav")
186
187# ──────────────────────────────────────────────────────────────────────────────
188# Step 4 — Run MkDocs

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected