MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / render_navigation

Function render_navigation

codewiki/src/fe/template_utils.py:44–79  ·  view source on GitHub ↗

Render navigation HTML from module tree structure. Args: module_tree: Dictionary representing the module tree current_page: Current page filename for highlighting Returns: HTML string for navigation

(module_tree: Dict[str, Any], current_page: str = "")

Source from the content-addressed store, hash-verified

42
43
44def render_navigation(module_tree: Dict[str, Any], current_page: str = "") -> str:
45 """
46 Render navigation HTML from module tree structure.
47
48 Args:
49 module_tree: Dictionary representing the module tree
50 current_page: Current page filename for highlighting
51
52 Returns:
53 HTML string for navigation
54 """
55 if not module_tree:
56 return ""
57
58 nav_template = """
59 {%- for section_key, section_data in module_tree.items() %}
60 <div class="nav-section">
61 <h3>{{ section_key.replace('_', ' ').title() }}</h3>
62 {%- if section_data.get('components') %}
63 <a href="/{{ section_key }}.md" class="nav-item {{ 'active' if current_page == section_key + '.md' else '' }}">Overview</a>
64 {%- endif %}
65 {%- if section_data.get('children') %}
66 {%- for child_key, child_data in section_data['children'].items() %}
67 <div class="nav-subsection">
68 <a href="/{{ child_key }}.md" class="nav-item {{ 'active' if current_page == child_key + '.md' else '' }}">{{ child_key.replace('_', ' ').title() }}</a>
69 </div>
70 {%- endfor %}
71 {%- endif %}
72 </div>
73 {%- endfor %}
74 """
75
76 return render_template(nav_template, {
77 'module_tree': module_tree,
78 'current_page': current_page
79 })
80
81
82def render_job_list(jobs: list) -> str:

Callers

nothing calls this directly

Calls 1

render_templateFunction · 0.85

Tested by

no test coverage detected