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

Function render_template

codewiki/src/fe/template_utils.py:20–41  ·  view source on GitHub ↗

Render template using Jinja2. Args: template: HTML template string with Jinja2 syntax context: Dictionary of variables to substitute Returns: Rendered HTML string

(template: str, context: Dict[str, Any])

Source from the content-addressed store, hash-verified

18
19
20def render_template(template: str, context: Dict[str, Any]) -> str:
21 """
22 Render template using Jinja2.
23
24 Args:
25 template: HTML template string with Jinja2 syntax
26 context: Dictionary of variables to substitute
27
28 Returns:
29 Rendered HTML string
30 """
31 # Create Jinja2 environment with string template
32 env = Environment(
33 loader=StringTemplateLoader(template),
34 autoescape=select_autoescape(['html', 'xml']),
35 trim_blocks=True,
36 lstrip_blocks=True
37 )
38
39 # Get template and render
40 jinja_template = env.get_template('')
41 return jinja_template.render(**context)
42
43
44def render_navigation(module_tree: Dict[str, Any], current_page: str = "") -> str:

Callers 7

indexFunction · 0.85
serve_docFunction · 0.85
index_getMethod · 0.85
index_postMethod · 0.85
serve_generated_docsMethod · 0.85
render_navigationFunction · 0.85
render_job_listFunction · 0.85

Calls 1

Tested by

no test coverage detected