Releases: go-humble/temple
Version 0.1.3
This version updates the contribution guidelines in CONTRIBUTING.md. There are no actual code changes.
Version 0.1.2
This release fixes a typo and updates the README to use a new version badge. There are no code changes.
Version 0.1.1
This release fixes a bug where partials were not being associated with one another correctly. It is 100% backwards compatible.
Full Changelog
- Fix a bug where partials were not being associated with one another correctly.
Version 0.1.0
This release changes the way templates, layouts, and partials are accessed once they have been added to a group. Instead of getting them from the map directly, you must now use the GetTemplate
, GetPartial
, and GetLayout
methods. We've also implemented new helper methods MustGetTemplate
, MustGetPartial
, and MustGetLayout
, which work like Template.Must
in the text/html package from the standard library and panic if a template, layout, or partial could not be found with the given name. The MustGet methods are especially useful for variable declarations.
Instead of the annoyingly repetitive:
var (
indexTmpl temple.Template
homeTmpl tempe.Template
todoTmple temple.Template
)
func init() {
var found bool
indexTmpl, found = group.Templates["index"]
if !found {
panic("Could not find template called index")
}
homeTmpl, found = group.Templates["home"]
if !found {
panic("Could not find template called home")
}
todoTmpl, found = group.Templates["todo"]
if !found {
panic("Could not find template called todo")
}
}
You can now simply write:
var (
indexTmpl = group.MustGetTemplate("index")
homeTmpl = group.MustGetTemplate("home")
todoTmple = group.MustGetTemplate("todo")
)
The code generated by the command line tool now exposes the GetX and MustGetX methods of the group as exported top-level functions:
var (
GetTemplate func(name string) (*temple.Template, error)
GetPartial func(name string) (*temple.Partial, error)
GetLayout func(name string) (*temple.Layout, error)
MustGetTemplate func(name string) *temple.Template
MustGetPartial func(name string) *temple.Partial
MustGetLayout func(name string) *temple.Layout
)
Full Changelog
- The
Templates
,Partials
, andLayouts
properties ofGroup
are no longer exported. - Implemented
GetTemplate
,GetPartial
, andGetLayout
methods onGroup
, which are to be used instead of direct map access. - Implemented
MustGetTemplate
,MustGetPartial
, andMustGetLayout
which panic if a template, partial, or layout with the given name was not found.
Version 0.0.1
This is the first official release of the temple command line tool and library. Everything is already well documented and pretty well tested. However, we still need to write karma tests for the methods that deal with loading inline templates and rendering to the DOM. There are also some important features planned for release in the near future.