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

Function _render_class

Scripts/emit_docs.py:213–409  ·  view source on GitHub ↗
(cls: dict, class_map: dict)

Source from the content-addressed store, hash-verified

211
212
213def _render_class(cls: dict, class_map: dict) -> str:
214 lines = []
215 kind = cls.get('kind', 'class').capitalize()
216 name = cls.get('name', '')
217 parent = cls.get('parent', '')
218 brief = _clean_brief(cls.get('brief') or '')
219 desc = cls.get('description', '')
220 macro = cls.get('macro', '')
221
222 lines.append('---')
223 lines.append('tags:')
224 lines.append(f' - {kind}')
225 if cls.get('is_blueprint_spawnable'):
226 lines.append(' - BlueprintSpawnable')
227 lines.append('---')
228
229 # Header
230 lines.append(f'# {name}')
231 if brief:
232 lines.append(f'\n> {brief}\n')
233 if desc:
234 lines.append(f'{desc}\n')
235
236 # Metadata table
237 meta_rows = []
238 meta_rows.append(f'| Kind | `{kind}` |')
239 if macro:
240 meta_rows.append(f'| UE Macro | `{macro}` |')
241 if parent:
242 # Try to link parent
243 parent_link = f'[{parent}](/{class_map[parent].replace(".md", "")}/)' if parent in class_map else f'`{parent}`'
244 meta_rows.append(f'| Inherits | {parent_link} |')
245 if cls.get('is_blueprint_spawnable'):
246 meta_rows.append('| Blueprint Spawnable | ✅ Yes |')
247 if meta_rows:
248 lines.append('| Attribute | Value |')
249 lines.append('|---|---|')
250 lines.extend(meta_rows)
251 lines.append('')
252
253 # Quick Navigation
254 sections = []
255 has_props = any(not p.get('is_override_toggle') for p in cls.get('properties', []))
256 has_funcs = any(f.get('brief') or f.get('macro') == 'UFUNCTION' for f in cls.get('functions', []))
257
258 if has_props:
259 sections.append(('Properties', '#properties'))
260 if has_funcs:
261 sections.append(('Functions', '#functions'))
262
263 if sections:
264 nav_html = '<div style="display: flex; gap: 12px; margin-bottom: 32px; flex-wrap: wrap;">\n'
265 for title, link in sections:
266 nav_html += f' <a href="{link}" class="md-button md-button--primary" style="margin: 0;">{title}</a>\n'
267 nav_html += '</div>\n'
268 lines.append(nav_html)
269
270 # ── Properties ──

Callers 1

emit_docsFunction · 0.85

Calls 6

_clean_briefFunction · 0.85
_link_typeFunction · 0.85
_escFunction · 0.85
_editor_badgeFunction · 0.85
_blueprint_prop_badgeFunction · 0.85
_blueprint_fn_badgeFunction · 0.85

Tested by

no test coverage detected