Initial commit: CodeMap v0.1.0 - CLI tool for code analysis and diagram generation
This commit is contained in:
21
codemap/templates/__init__.py
Normal file
21
codemap/templates/__init__.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
|
||||
def get_template(template_name: str) -> str:
|
||||
templates_dir = os.path.dirname(__file__)
|
||||
env = Environment(loader=FileSystemLoader(templates_dir))
|
||||
template = env.get_template(template_name)
|
||||
return template.render()
|
||||
|
||||
|
||||
def render_html(mermaid_content: str, title: str = "Code Map", auto_refresh: bool = False, refresh_interval: int = 5) -> str:
|
||||
templates_dir = os.path.dirname(__file__)
|
||||
env = Environment(loader=FileSystemLoader(templates_dir))
|
||||
template = env.get_template("viewer.html")
|
||||
return template.render(
|
||||
mermaid_content=mermaid_content,
|
||||
title=title,
|
||||
auto_refresh=auto_refresh,
|
||||
refresh_interval=refresh_interval
|
||||
)
|
||||
Reference in New Issue
Block a user