-
Notifications
You must be signed in to change notification settings - Fork 68
Implement template loader #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Implement template loader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Implements a pluggable template loader for custom storage backends and wires it through the engine and config, with tests and documentation updates.
- Introduces an
ITemplateStoreinterface and defaultFileTemplateStore - Updates
ConfigandEngineto hold and register a template store - Adds unit tests, benchmarks updates, and usage examples in docs
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| values/drop_test.go | Benchmark loops incorrectly changed to for range b.N |
| render/file_template_store.go | New FileTemplateStore implementing ITemplateStore |
| render/context.go | Swaps os.ReadFile for TemplateStore.ReadTemplate |
| render/config.go | Adds TemplateStore field and defaults it in NewConfig |
| engine_test.go | Adds mock store test for RegisterTemplateStore |
| engine.go | Adds RegisterTemplateStore method |
| docs/TemplateStoreExample.md | Adds an embedded-FS example for ITemplateStore |
| README.md | Documents the new Template Store feature |
Comments suppressed due to low confidence (7)
render/context.go:58
- [nitpick] In Go idioms, interfaces typically don’t use an
Iprefix. Consider renamingITemplateStoretoTemplateStore.
type ITemplateStore interface {
engine_test.go:167
- [nitpick] Test function names should use CamelCase without underscores. Rename to
TestTemplateStorefor consistency with Go’s testing conventions.
func Test_template_store(t *testing.T) {
docs/TemplateStoreExample.md:20
- The comment refers to
ITemplateProviderbut the interface is namedITemplateStore. Update to match the actual interface name.
//implementation of ITemplateProvider
values/drop_test.go:40
- The benchmark loop
for range b.Nis invalid;b.Nis an integer, not a slice or map. Revert tofor i := 0; i < b.N; i++ {.
for range b.N {
values/drop_test.go:46
- The benchmark loop
for range b.Nis invalid; usefor i := 0; i < b.N; i++ {instead.
for range b.N {
values/drop_test.go:53
- The benchmark loop
for range b.Nis invalid; replace with a standardfor i := 0; i < b.N; i++ {.
for range b.N {
README.md:168
- The example call omits the required argument. Change to
engine.RegisterTemplateStore(embedFileSystemTemplateStore).
engine.RegisterTemplateStore()
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Thanks! |
Updated CHANGELOG.md to include all merged PRs since version 1.3.0 (2020-02-13): Added features: - Jekyll Extensions Support (#114) - Auto-Escape Feature (#111) - Template Loader (#107) - BasicEngine (#104) - JSON Filter (#84) - Strict Variables Mode (#74) - Custom Writer Support (#86) - Template AST Access (#59, #66) - For-Else Support (#93) - Unless-Else Support (#68) - General Range Expressions (#65) - Loop Modifier Expressions (#67) Fixes: - Size filter, slice bounds, division by zero - Nil pointer handling - Whitespace control - Multiline slice - Block errors - Map filter with structs - And more Also added steve-ky as contributor for ideas/feedback on PR #89. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Implement template loader.
Checklist
make testpasses.make lintpasses.