Parent
#1 — context2html Framework
What to build
Add data-zone attributes to both templates (starter.html, report-starter.html) to replace comment-based insertion points, then build context2html/renderer.py that assembles components into templates.
Template changes:
<style data-zone="component-css"></style>
<div data-zone="component-html"></div>
<script data-zone="component-js"></script>
Keep existing <!-- INSERT: ... --> comments as fallback for backward compatibility. Update scripts/sync-template-styles.py to preserve data-zone attributes when syncing CSS from base-styles.css.
Renderer API:
TemplateRenderer.assemble(template_name, components, theme_name) → complete HTML string
template_name: "report-starter" or "starter" (resolved via known path)
components: list of component IDs (strings) — passed to registry for lookup
theme_name: theme name for <html data-theme="xxx">
What assemble() does:
- Load the template HTML file
- Set
<html data-theme="xxx"> on the root element
- For each component ID, get Component from Registry, append HTML at
data-zone="component-html"
- Merge all component CSS into
data-zone="component-css" (dedup via selector prefix)
- Append all component JS at
data-zone="component-js"
- Return the assembled HTML
Acceptance criteria
Blocked by
Parent
#1 — context2html Framework
What to build
Add
data-zoneattributes to both templates (starter.html,report-starter.html) to replace comment-based insertion points, then buildcontext2html/renderer.pythat assembles components into templates.Template changes:
Keep existing
<!-- INSERT: ... -->comments as fallback for backward compatibility. Updatescripts/sync-template-styles.pyto preservedata-zoneattributes when syncing CSS frombase-styles.css.Renderer API:
TemplateRenderer.assemble(template_name, components, theme_name)→ complete HTML stringtemplate_name:"report-starter"or"starter"(resolved via known path)components: list of component IDs (strings) — passed to registry for lookuptheme_name: theme name for<html data-theme="xxx">What assemble() does:
<html data-theme="xxx">on the root elementdata-zone="component-html"data-zone="component-css"(dedup via selector prefix)data-zone="component-js"Acceptance criteria
data-zoneattributes for css, html, and js zonessync-template-styles.pypreservesdata-zoneattributes during syncrender("starter", ["26"], "warm")returns valid HTML with component #26 embeddedBlocked by