Releases: rur/treetop
Patch fix for Vary header assignment
Stricter template validation and executor refactor
A refactor of executors, with stricter template validation.
Breaking Changes
-
A template will be rejected with an error if it does not contain a template or block declaration
for all defined sub-view names.tErr.Error() => template example.html.tmpl: missing template declaration(s) for sub view blocks: "my-block"
- The above can be corrected by adding
{{ template "my-block" .MyBlock }}
to example.html.tmpl.
- The above can be corrected by adding
Added
-
New
treetop.ServeClientLibrary
handler serving an embedded copy of the treetop-client JS, for convenience sake -
Add
view.HasSubView
method to assert the existence of a sub view name without specifying a template.myPage := treetop.NewView("base.html.tmpl", BaseHandler) myPage.HasSubView("sidebar") // no template or handler specified
Housekeeping
- Add test coverage for DeveloperExecutor forced reloading
- Major refactor of Executors to remove duplicate code. The behavior of all executors should remain the same!
- Replace deprecated use of
HeaderMap
in favor of.Header()
FS executor bug fix for RC zero
Quick fix for an issue in the previous release affecting the FS executor.
Bugfix
FileSystemExecutor
was memoizing template contents- This is of little benefit since it only helps at startup time
- The template contents stay in memory for the lifetime of the app
Housekeeping
- Add test coverage for DeveloperExecutor forced reloading
Executors Refactor & Template Validation
A refactor of executors, with stricter template validation which may cause breakage.
Added
-
New
treetop.ServeClientLibrary
handler serving an embedded copy of the treetop-client JS, for convenience sake -
Add
view.HasSubView
method to assert the existence of a sub view name without specifying a template.myPage := treetop.NewView("base.html.tmpl", BaseHandler) myPage.HasSubView("sidebar") // no template or handler specified
Breaking Changes
-
A template will be rejected with an error if it does not contain a template or block declaration
for all defined sub-view names.tErr.Error() => template example.html.tmpl: missing template declaration(s) for sub view blocks: "my-block"
- The above can be corrected by adding
{{ template "my-block" .MyBlock }}
to example.html.tmpl.
- The above can be corrected by adding
Housekeeping
- Major refactor of Executors to remove duplicate code. The behavior of all executors should remain the same!
- Replace deprecated use of
HeaderMap
in favor of.Header()
Housekeeping update
- Test with latest stable Golang version 1.16
- Move Treetop Demo code into a separate repo https://github.com/rur/treetop-demo
Bug fixes and minor new features
New Features
FileExecutor
andFileSystemExecutor
now have an optionalKeyedString
property to mix files with hard coded templates- Added
Template
interface so thatTemplateHandler
no longer depends directly on html/template
Bugfix
- Template cache not used/not working when constructing template in file executors
- Files not being closed properly in FS executor
API and implementation overhaul, first stable candidate
A quality focused overhaul from the prototype implementation, with many breaking API changes. This release is intended to establish a clear scope for the project and a viable candidate to stabilize.
Views and Executors
Focus library towards constructing endpoints using views, as abstract definitions; and executors to plumb everything together. Executor API was made as extensible as possible to avoid future scope creep for this project.
HTML Template Protocol
For page view hot-swapping, use the content-type header "application/x.treetop-html-template+xml"
Treetop Client v0.9.0
was created to accommodate changes in the protocol introduced in this release.
Review the CHANGELOG.md for more details.
Add clarifications to the prototype library API and improve code docs.
Bugfix
- Writer implementation was not including query in response URL header
Breaking API Changes
- Remove
treetop.Renderer
type, unnecessary since it only wrapsTemplateExec
- Add TemplateExec parameter to
treetop.NewView..
API method for creating base views - Rename
treetop.TreetopWriter
interface totreetop.Writer
to conform to naming guidelines - Remove
treetop.Test
, testing recipes and resources belong elsewhere - Split
treetop.Writer
function intotreetop.NewPartialWriter
andtreetop.NewFragmentWriter
and remove the confusingisPartial
flag - Change
treetop.View
from an interface to a struct and expose internals to make debugging easier - Rename
HandlePartial
method toHandleSubView
intreetop.Response
interface to be consistent with the view builder - Rename
Done
method toFinished
intreetop.Response
interface - Rename
HandlerFunc
signature type toViewHandlerFunc
to make a clearer association with the view builder