feat(tmpl): template renderer + BaseData (bookshelf-qqz.7) #8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "bd-bookshelf-qqz.7"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
internal/tmplpackage withRenderer(buffer-firsthtml/templaterendering),BaseDatastruct, andBuildBaseDatahelpertemplates/layouts/base.html(HTML5 skeleton with{{block "content" .}}slot) andtemplates/pages/home.htmltemplates/templates.gowith//go:embedFS declaration for the production binarymiddleware.NewContextWithTraceIDso cross-package tests can inject a trace ID without running the full middleware chaininternal/tmplvia Ginkgo v2 +fstest.MapFSTest plan
make testpasses (all internal packages green, race detector clean)make coveragereports 100% oninternal/text/html; charset=utf-8BuildBaseDatapropagates TraceID from context (present and absent cases)Closes bead bookshelf-qqz.7 on merge.
- internal/tmpl: NewRenderer(fs.FS), Render(w, r, layout, page, data) with buffer-first rendering so parse/execute errors never write partial bytes - internal/tmpl: BaseData{AssetVersion, TraceID, Title} + BuildBaseData helper reading trace ID via middleware.TraceIDFromContext - internal/middleware: export NewContextWithTraceID for use in cross-package tests - templates/layouts/base.html: full HTML5 skeleton with {{block "content" .}} slot - templates/pages/home.html: defines the content block with welcome message - templates/templates.go: //go:embed FS declaration for production binary - 100% test coverage on internal/tmpl (Ginkgo v2 + fstest.MapFS)1a7e062013toa96a7b6aa1491913343fe637ce1ec9