Jellyfish042's picture
Checkpoint before tooltip palette update
350392a
raw
history blame contribute delete
413 Bytes
"""
Page rendering using a lightweight template.
"""
from pathlib import Path
from string import Template
from typing import Dict
_TEMPLATE_PATH = Path(__file__).resolve().parent / "templates" / "page.html.tmpl"
def render_page(context: Dict[str, str]) -> str:
template_text = _TEMPLATE_PATH.read_text(encoding="utf-8")
template = Template(template_text)
return template.safe_substitute(context)